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

Diff of /branches/diaplayground/finley/src/CPPAdapter/MeshAdapter.cpp

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

revision 102 by jgs, Wed Dec 15 07:08:39 2004 UTC revision 121 by jgs, Fri May 6 04:26:16 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 905  bool MeshAdapter::probeInterpolationACro Line 976  bool MeshAdapter::probeInterpolationACro
976  {  {
977      return false;      return false;
978  }  }
979  bool MeshAdapter::operator==(const MeshAdapter& other) const  
980    bool MeshAdapter::operator==(const AbstractDomain& other) const
981  {  {
982    return (m_finleyMesh==other.m_finleyMesh);    const MeshAdapter* temp=dynamic_cast<const MeshAdapter*>(&other);
983      if (temp!=0) {
984        return (m_finleyMesh==temp->m_finleyMesh);
985      } else {
986        return false;
987      }
988    }
989    
990    bool MeshAdapter::operator!=(const AbstractDomain& other) const
991    {
992      return !(operator==(other));
993  }  }
994    
995  int MeshAdapter::getSystemMatrixTypeId(const int solver, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const bool symmetry) const
# Line 929  Data MeshAdapter::getSize() const Line 1011  Data MeshAdapter::getSize() const
1011    return function(asAbstractContinuousDomain()).getSize();    return function(asAbstractContinuousDomain()).getSize();
1012  }  }
1013    
1014    int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1015    {
1016      int* tagList;
1017      int numTags;
1018      getTagList(functionSpaceType, &tagList, &numTags);
1019      return tagList[sampleNo];
1020    }
1021    
1022  bool MeshAdapter::operator!=(const MeshAdapter& other) const  int MeshAdapter::getReferenceNoFromSampleNo(int functionSpaceType, int sampleNo) const
1023  {  {
1024    return !operator==(other);    int* referenceNoList;
1025      int numReferenceNo;
1026      getReferenceNoList(functionSpaceType, &referenceNoList, &numReferenceNo);
1027      return referenceNoList[sampleNo];
1028  }  }
1029  // bool MeshAdapter::operator==(const AbstractDomain& other) const  
 // {  
   // try {  
     // const MeshAdapter& ref = dynamic_cast<const MeshAdapter&>(other);  
     // return (operator==(ref));  
   // }  
   // catch (bad_cast) {  
     // return false;  
   // }  
 // }  
1030  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.102  
changed lines
  Added in v.121

  ViewVC Help
Powered by ViewVC 1.1.26