[petsc-dev] changes to the TS structure

Barry Smith bsmith at mcs.anl.gov
Wed May 19 15:36:43 CDT 2010


On May 19, 2010, at 3:19 PM, Lisandro Dalcin wrote:

> On 19 May 2010 16:18, Barry Smith <bsmith at mcs.anl.gov> wrote:
>> 
>> On May 19, 2010, at 2:07 PM, Jed Brown wrote:
>> 
>>> On Wed, 19 May 2010 15:17:19 -0300, Lisandro Dalcin <dalcinl at gmail.com> wrote:
>>>> If you do have the SNES availabe at the point you setIFunction(vec,
>>>> func), then yes, there is no much to gain from having TS hold a ref to
>> 
> 
> Barry/Jed, many thanks for your comments. Now things are far more
> clear. So we should make KSPGetSolution(), KSPGetRHS(), etc. create
> the inner vecs, and similarly for SNES and TS.

   We could. I don't know all the ramifications of doing this and if it could break things.

   Also, with my plan to "merge" the "style" of DMMG into the TS, SNES, and KSP object would have the DM object be responsible for setting some of the correct values into those inner objects. So, for example, with KSPGetSolution() the KSP would do a VecCreate() with the appropriate MPI_Comm but the DM would then set the appropriate layout/sizes to that Vec.  A crude form of this would be 
KSPGetSolution(KSP ksp,Vec *v)
{
   if (!ksp->vec_sol) {
      VecCreate(ksp->comm,v);
      if (ksp->dm) {
         DMSetUpGlobalVector(ksp->dm,v);
     }
  }

Note that this requires pulling the VecCreate() part out of DMCreateGlobalVector();  so that it just "finishes" the job of creating the vector. Similar for PCGetOperators()

PCGetOperators(PC pc,Mat *A) /* for the example pretend takes only one matrix */
{
   if (!pc->mat) {
      ierr = MatCreate(pc->comm,A);
      if (pc->dm) {
         DMSetUpMatrix(pc->dm,A); 
     }
  }

  where similarly DMSetUpMatrix() is like DMGetMatrix() with the the MatCreate() part.

The details of all this are not yet clear in my mind.


   Barry

   
> 
> 
> -- 
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169




More information about the petsc-dev mailing list