Changeset 22116
- Timestamp:
- 09/20/17 06:29:26 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
issm/trunk-jpl/src/c/classes/FemModel.cpp
r22100 r22116 4601 4601 /*Intermediaries*/ 4602 4602 int numberofelements = this->elements->NumberOfElements(); 4603 int numberofvertices = this->vertices->NumberOfVertices();4604 4603 IssmDouble* error_elements = NULL; 4605 IssmDouble* error_vertices = NULL;4606 4604 IssmDouble *x = NULL; 4607 4605 IssmDouble *y = NULL; … … 4609 4607 int *index = NULL; 4610 4608 IssmDouble maxerror,threshold,resolution; 4609 int vid; 4611 4610 4612 4611 switch(errorestimator_type){ … … 4629 4628 this->GetMesh(this->vertices,this->elements,&x,&y,&z,&index); 4630 4629 4631 /*Sum the estimators over the vertices*/4632 error_vertices=xNewZeroInit<IssmDouble>(numberofvertices);4633 for(int i=0;i<numberofelements;i++){4634 for(int j=0;j<this->GetElementsWidth();j++){4635 int vid=index[i*this->GetElementsWidth()+j]-1;//Matlab to C indexing4636 error_vertices[vid]+=error_elements[i];4637 }4638 }4639 4640 4630 /*Find the max of the estimators (use error_elements)*/ 4641 4631 maxerror=error_elements[0]; … … 4643 4633 4644 4634 /*Fill hmaxvertices*/ 4645 for(int i=0;i<numberofvertices;i++){ 4646 if(error_vertices[i]>threshold*maxerror){ 4647 if(xIsNan<IssmDouble>(hmaxvertices[i])) hmaxvertices[i]=resolution; 4648 else hmaxvertices[i]=min(resolution,hmaxvertices[i]); 4635 for(int i=0;i<numberofelements;i++){ 4636 if(error_elements[i]>threshold*maxerror){ 4637 /*ok, fill the hmaxvertices using the element vertices*/ 4638 for(int j=0;j<this->GetElementsWidth();j++){ 4639 vid=index[i*this->GetElementsWidth()+j]-1;//Matlab to C indexing 4640 if(xIsNan<IssmDouble>(hmaxvertices[vid])) hmaxvertices[vid]=resolution; 4641 else hmaxvertices[vid]=min(resolution,hmaxvertices[vid]); 4642 } 4649 4643 } 4650 4644 } … … 4656 4650 xDelete<int>(index); 4657 4651 xDelete<IssmDouble>(error_elements); 4658 xDelete<IssmDouble>(error_vertices);4659 4652 } 4660 4653 /*}}}*/
Note:
See TracChangeset
for help on using the changeset viewer.