/[escript]/trunk/finley/src/CPPAdapter/MeshAdapter.cpp
ViewVC logotype

Diff of /trunk/finley/src/CPPAdapter/MeshAdapter.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 104 by jgs, Fri Dec 17 07:43:12 2004 UTC revision 110 by jgs, Mon Feb 14 04:14:42 2005 UTC
# Line 179  int MeshAdapter::getDiracDeltaFunctionCo Line 179  int MeshAdapter::getDiracDeltaFunctionCo
179  {  {
180    return Points;    return Points;
181  }  }
   
 int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const  
 {  
   //  
   // It is assumed the sampleNo has been checked  
   // before calling this function.  
   int* tagList;  
   int numTags;  
   getTagList(functionSpaceType, &tagList, &numTags);  
   return tagList[sampleNo];  
 }  
   
182  //  //
183  // returns a pointer to the tag list of samples of functionSpaceType  // returns a pointer to the tag list of samples of functionSpaceType
184  //  //
# Line 256  void MeshAdapter::getTagList(int functio Line 244  void MeshAdapter::getTagList(int functio
244      throw FinleyAdapterException(temp.str());      throw FinleyAdapterException(temp.str());
245      break;      break;
246    }    }
247      if (*tagList==NULL) {
248        stringstream temp;
249        temp << "Error - no tags available for " << functionSpaceType << " for domain: " << getDescription();
250        throw FinleyAdapterException(temp.str());
251      }
252      return;
253    }
254    //
255    // returns a pointer to the reference no list of samples of functionSpaceType
256    //
257    void MeshAdapter::getReferenceNoList(int functionSpaceType, int** referenceNoList,
258                     int* numReferenceNo) const
259    {
260      *referenceNoList=NULL;
261      *numReferenceNo=0;
262      Finley_Mesh* mesh=m_finleyMesh.get();
263      switch (functionSpaceType) {
264      case(Nodes):
265        if (mesh->Nodes!=NULL) {
266          *referenceNoList=mesh->Nodes->Id;
267          *numReferenceNo=mesh->Nodes->numNodes;
268        }
269        break;
270      case(Elements):
271        if (mesh->Elements!=NULL) {
272          *referenceNoList=mesh->Elements->Id;
273          *numReferenceNo=mesh->Elements->numElements;
274        }
275        break;
276      case(FaceElements):
277        if (mesh->FaceElements!=NULL) {
278          *referenceNoList=mesh->FaceElements->Id;
279          *numReferenceNo=mesh->FaceElements->numElements;
280        }
281        break;
282      case(Points):
283        if (mesh->Points!=NULL) {
284          *referenceNoList=mesh->Points->Id;
285          *numReferenceNo=mesh->Points->numElements;
286        }
287        break;
288      case(ContactElementsZero):
289        if (mesh->ContactElements!=NULL) {
290          *referenceNoList=mesh->ContactElements->Id;
291          *numReferenceNo=mesh->ContactElements->numElements;
292        }
293        break;
294      case(ContactElementsOne):
295        if (mesh->ContactElements!=NULL) {
296          *referenceNoList=mesh->ContactElements->Id;
297          *numReferenceNo=mesh->ContactElements->numElements;
298        }
299        break;
300      case(DegreesOfFreedom):
301        if (mesh->Nodes!=NULL) {
302          *referenceNoList=NULL;
303          *numReferenceNo=0;
304        }
305        break;
306      case(ReducedDegreesOfFreedom):
307        if (mesh->Nodes!=NULL) {
308          *referenceNoList=NULL;
309          *numReferenceNo=0;
310        }
311        break;
312      default:
313        stringstream temp;
314        temp << "Error - Invalid function space type: "
315         << functionSpaceType << " for domain: " << getDescription();
316        throw FinleyAdapterException(temp.str());
317        break;
318      }
319      if (*referenceNoList==NULL) {
320        stringstream temp;
321        temp << "Error - reference number list available for " << functionSpaceType << " for domain: " << getDescription();
322        throw FinleyAdapterException(temp.str());
323      }
324    return;    return;
325  }  }
326    
# Line 747  void MeshAdapter::saveDX(const std::stri Line 812  void MeshAdapter::saveDX(const std::stri
812    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));    Finley_Mesh_saveDX(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));
813    checkFinleyError();    checkFinleyError();
814  }  }
815    // saves a data array in openVTK format:
816    void MeshAdapter::saveVTK(const std::string& filename,const Data& arg) const
817    {
818      Finley_Mesh_saveVTK(filename.c_str(),m_finleyMesh.get(),&(arg.getDataC()));
819      checkFinleyError();
820    }
821  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:  // creates a SystemMatrixAdapter stiffness matrix an initializes it with zeros:
822  SystemMatrixAdapter MeshAdapter::newSystemMatrix(  SystemMatrixAdapter MeshAdapter::newSystemMatrix(
823                        const int row_blocksize,                        const int row_blocksize,
# Line 935  Data MeshAdapter::getSize() const Line 1006  Data MeshAdapter::getSize() const
1006    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();
1007  }  }
1008    
1009    int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1010    {
1011      int* tagList;
1012      int numTags;
1013      getTagList(functionSpaceType, &tagList, &numTags);
1014      return tagList[sampleNo];
1015    }
1016    
1017    int MeshAdapter::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const
1018    {
1019      int* referenceNoList;
1020      int numReferenceNo;
1021      getReferenceNoList(functionSpaceType, &referenceNoList, &numReferenceNo);
1022      return referenceNoList[sampleNo];
1023    }
1024    
1025  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.104  
changed lines
  Added in v.110

  ViewVC Help
Powered by ViewVC 1.1.26