Changeset 21812


Ignore:
Timestamp:
07/18/17 20:26:11 (8 years ago)
Author:
Mathieu Morlighem
Message:

CHG: done with metric

Location:
issm/trunk-jpl/src/c/classes
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified issm/trunk-jpl/src/c/classes/AmrBamg.cpp

    r21804 r21812  
    1717
    1818/*Constructor, copy, clean up and destructor*/
    19 AmrBamg::AmrBamg(IssmDouble hmin, IssmDouble hmax){/*{{{*/
     19AmrBamg::AmrBamg(IssmDouble hmin, IssmDouble hmax,int fieldenum_in,IssmDouble err){/*{{{*/
    2020
     21        this->fieldenum    = fieldenum_in;
    2122        this->geometry     = NULL;
    2223        this->fathermesh   = NULL;
     
    4748        this->options->hmin              = hmin;
    4849        this->options->hmax              = hmax;
     50
     51        this->options->err=xNew<IssmDouble>(1);
     52        this->options->errSize[0]=1;
     53        this->options->errSize[1]=1;
     54        this->options->err[0] = err;
    4955}
    5056/*}}}*/
     
    8086        delete Th;
    8187}/*}}}*/
    82 void AmrBamg::ExecuteRefinementBamg(int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist){/*{{{*/
     88void AmrBamg::ExecuteRefinementBamg(IssmDouble* field,int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist){/*{{{*/
    8389
    8490        /*Intermediaries*/
     
    9096        _assert_(this->options);
    9197        _assert_(this->fathermesh);
     98        _assert_(field);
     99
     100        /*Prepare field for metric*/
     101        this->options->field = field;
    92102
    93103        /*remesh*/
    94104        if(this->previousmesh){
     105                this->options->fieldSize[0] = this->previousmesh->VerticesSize[0];
     106                this->options->fieldSize[1] = 1;
    95107                Bamgx(meshout,geomout,this->previousmesh,this->geometry,this->options);
    96108        }
    97109        else{
     110                this->options->fieldSize[0] = this->fathermesh->VerticesSize[0];
     111                this->options->fieldSize[1] = 1;
    98112                Bamgx(meshout,geomout,this->fathermesh,this->geometry,this->options);
    99113        }
     114
     115        /*remove field for memory management (FemModel is taking care of deleting it)*/
     116        this->options->field = NULL;
     117        this->options->fieldSize[0] = 0;
     118        this->options->fieldSize[1] = 0;
    100119
    101120        /*Change previous mesh*/
  • TabularUnified issm/trunk-jpl/src/c/classes/AmrBamg.h

    r21802 r21812  
    1313
    1414        public:
     15                int fieldenum;
     16
    1517                /* Constructor, destructor etc*/
    16                 AmrBamg(IssmDouble hmin, IssmDouble hmax);
     18                AmrBamg(IssmDouble hmin, IssmDouble hmax,int fieldenum_in,IssmDouble err_in);
    1719                ~AmrBamg();
    1820
    1921                /*General methods*/
    2022                void Initialize(int* elements,IssmDouble* x,IssmDouble* y,int numberofvertices,int numberofelements);
    21                 void ExecuteRefinementBamg(int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist);
     23                void ExecuteRefinementBamg(IssmDouble* field,int* pnewnumberofvertices,int *pnewnumberofelements,IssmDouble** px,IssmDouble** py,IssmDouble** pz,int** pelementslist);
    2224
    2325        private:
  • TabularUnified issm/trunk-jpl/src/c/classes/FemModel.cpp

    r21806 r21812  
    43014301        int my_rank     = IssmComm::GetRank();
    43024302
     4303        /*Get vector to create metric*/
     4304        int numberofvertices = this->vertices->NumberOfVertices();
     4305        Vector<IssmDouble> *vector = new Vector<IssmDouble>(numberofvertices);
     4306        GetVectorFromInputsx(&vector,this,this->amrbamg->fieldenum,VertexSIdEnum);
     4307        vector->Assemble();
     4308        IssmDouble* vector_serial = vector->ToMPISerial();
     4309        delete vector;
     4310
    43034311        if(my_rank==0){
    4304                 this->amrbamg->ExecuteRefinementBamg(&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist);
     4312                this->amrbamg->ExecuteRefinementBamg(vector_serial,&newnumberofvertices,&newnumberofelements,&newx,&newy,&newz,&newelementslist);
    43054313                if(newnumberofvertices<=0 || newnumberofelements<=0) _error_("Error in the refinement process.");
    43064314        }
     
    43114319                newelementslist=xNew<int>(newnumberofelements*this->GetElementsWidth());
    43124320        }
     4321        xDelete<IssmDouble>(vector_serial);
    43134322
    43144323        /*Send new mesh to others CPU*/
     
    43584367        this->parameters->FindParam(&err,AmrErrEnum);
    43594368
    4360         /*Create bamg data structures for bamg (only cpu 0)*/
     4369        /*Create bamg data structures for bamg*/
     4370        this->amrbamg = new AmrBamg(hmin,hmax,fieldenum,err);
     4371
     4372        /*Re-create original mesh and put it in bamg structure (only cpu 0)*/
    43614373        if(my_rank==0){
    4362                 /*Re-create original mesh and put it in bamg structure*/
    4363                 this->amrbamg = new AmrBamg(hmin,hmax);
    43644374                this->amrbamg->Initialize(elements,x,y,numberofvertices,numberofelements);
    43654375        }
Note: See TracChangeset for help on using the changeset viewer.