/[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 4441 by caltinay, Fri Jun 7 02:23:49 2013 UTC revision 4496 by caltinay, Mon Jul 15 06:53:44 2013 UTC
# Line 46  const int MeshAdapter::ReducedContactEle Line 46  const int MeshAdapter::ReducedContactEle
46  const int MeshAdapter::ContactElementsOne=FINLEY_CONTACT_ELEMENTS_2;  const int MeshAdapter::ContactElementsOne=FINLEY_CONTACT_ELEMENTS_2;
47  const int MeshAdapter::ReducedContactElementsOne=FINLEY_REDUCED_CONTACT_ELEMENTS_2;  const int MeshAdapter::ReducedContactElementsOne=FINLEY_REDUCED_CONTACT_ELEMENTS_2;
48    
49  MeshAdapter::MeshAdapter(Finley_Mesh* finleyMesh)  MeshAdapter::MeshAdapter(Mesh* finleyMesh)
50  {  {
51      setFunctionSpaceTypeNames();      setFunctionSpaceTypeNames();
52      // need to use a null_deleter as Finley_Mesh_free deletes the pointer      // need to use a null_deleter as Finley_Mesh_free deletes the pointer
# Line 66  MeshAdapter::~MeshAdapter() Line 66  MeshAdapter::~MeshAdapter()
66  {  {
67      // I hope the case for the pointer being zero has been taken care of      // I hope the case for the pointer being zero has been taken care of
68      if (m_finleyMesh.unique()) {      if (m_finleyMesh.unique()) {
69          Finley_Mesh_free(m_finleyMesh.get());          delete m_finleyMesh.get();
70      }      }
71  }  }
72    
# Line 106  MeshAdapter::getMPIComm() const Line 106  MeshAdapter::getMPIComm() const
106  #endif  #endif
107  }  }
108    
109  Finley_Mesh* MeshAdapter::getFinley_Mesh() const  Mesh* MeshAdapter::getFinley_Mesh() const
110  {  {
111      return m_finleyMesh.get();      return m_finleyMesh.get();
112  }  }
113    
114  void MeshAdapter::write(const string& fileName) const  void MeshAdapter::write(const string& fileName) const
115  {  {
116      Finley_Mesh_write(m_finleyMesh.get(), fileName.c_str());      m_finleyMesh.get()->write(fileName);
117      checkFinleyError();      checkFinleyError();
118  }  }
119    
120  void MeshAdapter::Print_Mesh_Info(const bool full) const  void MeshAdapter::Print_Mesh_Info(const bool full) const
121  {  {
122      Finley_PrintMesh_Info(m_finleyMesh.get(), full);      m_finleyMesh.get()->printInfo(full);
123  }  }
124    
125  void MeshAdapter::dump(const string& fileName) const  void MeshAdapter::dump(const string& fileName) const
# Line 128  void MeshAdapter::dump(const string& fil Line 128  void MeshAdapter::dump(const string& fil
128      const NcDim* ncdims[12] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};      const NcDim* ncdims[12] = {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL};
129      NcVar *ids;      NcVar *ids;
130      int *int_ptr;      int *int_ptr;
131      Finley_Mesh *mesh = m_finleyMesh.get();      Mesh *mesh = m_finleyMesh.get();
132      int num_Tags = 0;      int num_Tags = 0;
133      int mpi_size                         = mesh->MPIInfo->size;      int mpi_size                         = mesh->MPIInfo->size;
134      int mpi_rank                         = mesh->MPIInfo->rank;      int mpi_rank                         = mesh->MPIInfo->rank;
# Line 152  void MeshAdapter::dump(const string& fil Line 152  void MeshAdapter::dump(const string& fil
152      }      }
153  #endif  #endif
154    
155      char *newFileName = Esys_MPI_appendRankToFileName(fileName.c_str(),      const std::string newFileName(esysUtils::appendRankToFileName(fileName,
156                                                       mpi_size, mpi_rank);                                                       mpi_size, mpi_rank));
157    
158      // Figure out how much storage is required for tags      // Figure out how much storage is required for tags
159      num_Tags = mesh->tagMap.size();      num_Tags = mesh->tagMap.size();
# Line 161  void MeshAdapter::dump(const string& fil Line 161  void MeshAdapter::dump(const string& fil
161      // NetCDF error handler      // NetCDF error handler
162      NcError err(NcError::verbose_nonfatal);      NcError err(NcError::verbose_nonfatal);
163      // Create the file.      // Create the file.
164      NcFile dataFile(newFileName, NcFile::Replace);      NcFile dataFile(newFileName.c_str(), NcFile::Replace);
165      string msgPrefix("Error in MeshAdapter::dump: NetCDF operation failed - ");      string msgPrefix("Error in MeshAdapter::dump: NetCDF operation failed - ");
166      // check if writing was successful      // check if writing was successful
167      if (!dataFile.is_valid())      if (!dataFile.is_valid())
# Line 201  void MeshAdapter::dump(const string& fil Line 201  void MeshAdapter::dump(const string& fil
201              throw FinleyAdapterException(msgPrefix+"add_dim(dim_Tags)");              throw FinleyAdapterException(msgPrefix+"add_dim(dim_Tags)");
202    
203      // Attributes: MPI size, MPI rank, Name, order, reduced_order      // Attributes: MPI size, MPI rank, Name, order, reduced_order
204      if (!dataFile.add_att("mpi_size", mpi_size) )      if (!dataFile.add_att("mpi_size", mpi_size))
205          throw FinleyAdapterException(msgPrefix+"add_att(mpi_size)");          throw FinleyAdapterException(msgPrefix+"add_att(mpi_size)");
206      if (!dataFile.add_att("mpi_rank", mpi_rank) )      if (!dataFile.add_att("mpi_rank", mpi_rank))
207          throw FinleyAdapterException(msgPrefix+"add_att(mpi_rank)");          throw FinleyAdapterException(msgPrefix+"add_att(mpi_rank)");
208      if (!dataFile.add_att("Name",mesh->Name) )      if (!dataFile.add_att("Name",mesh->m_name.c_str()))
209          throw FinleyAdapterException(msgPrefix+"add_att(Name)");          throw FinleyAdapterException(msgPrefix+"add_att(Name)");
210      if (!dataFile.add_att("numDim",numDim) )      if (!dataFile.add_att("numDim",numDim))
211          throw FinleyAdapterException(msgPrefix+"add_att(order)");          throw FinleyAdapterException(msgPrefix+"add_att(order)");
212      if (!dataFile.add_att("order",mesh->integrationOrder) )      if (!dataFile.add_att("order",mesh->integrationOrder))
213          throw FinleyAdapterException(msgPrefix+"add_att(order)");          throw FinleyAdapterException(msgPrefix+"add_att(order)");
214      if (!dataFile.add_att("reduced_order",mesh->reducedIntegrationOrder) )      if (!dataFile.add_att("reduced_order",mesh->reducedIntegrationOrder))
215          throw FinleyAdapterException(msgPrefix+"add_att(reduced_order)");          throw FinleyAdapterException(msgPrefix+"add_att(reduced_order)");
216      if (!dataFile.add_att("numNodes",numNodes) )      if (!dataFile.add_att("numNodes",numNodes))
217          throw FinleyAdapterException(msgPrefix+"add_att(numNodes)");          throw FinleyAdapterException(msgPrefix+"add_att(numNodes)");
218      if (!dataFile.add_att("num_Elements",num_Elements) )      if (!dataFile.add_att("num_Elements",num_Elements))
219          throw FinleyAdapterException(msgPrefix+"add_att(num_Elements)");          throw FinleyAdapterException(msgPrefix+"add_att(num_Elements)");
220      if (!dataFile.add_att("num_FaceElements",num_FaceElements) )      if (!dataFile.add_att("num_FaceElements",num_FaceElements))
221          throw FinleyAdapterException(msgPrefix+"add_att(num_FaceElements)");          throw FinleyAdapterException(msgPrefix+"add_att(num_FaceElements)");
222      if (!dataFile.add_att("num_ContactElements",num_ContactElements) )      if (!dataFile.add_att("num_ContactElements",num_ContactElements))
223          throw FinleyAdapterException(msgPrefix+"add_att(num_ContactElements)");          throw FinleyAdapterException(msgPrefix+"add_att(num_ContactElements)");
224      if (!dataFile.add_att("num_Points",num_Points) )      if (!dataFile.add_att("num_Points",num_Points))
225          throw FinleyAdapterException(msgPrefix+"add_att(num_Points)");          throw FinleyAdapterException(msgPrefix+"add_att(num_Points)");
226      if (!dataFile.add_att("num_Elements_numNodes",num_Elements_numNodes) )      if (!dataFile.add_att("num_Elements_numNodes",num_Elements_numNodes))
227          throw FinleyAdapterException(msgPrefix+"add_att(num_Elements_numNodes)");          throw FinleyAdapterException(msgPrefix+"add_att(num_Elements_numNodes)");
228      if (!dataFile.add_att("num_FaceElements_numNodes",num_FaceElements_numNodes) )      if (!dataFile.add_att("num_FaceElements_numNodes",num_FaceElements_numNodes) )
229          throw FinleyAdapterException(msgPrefix+"add_att(num_FaceElements_numNodes)");          throw FinleyAdapterException(msgPrefix+"add_att(num_FaceElements_numNodes)");
# Line 628  int MeshAdapter::getDiracDeltaFunctionsC Line 628  int MeshAdapter::getDiracDeltaFunctionsC
628  //  //
629  int MeshAdapter::getDim() const  int MeshAdapter::getDim() const
630  {  {
631      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
632      int numDim=Finley_Mesh_getDim(mesh);      return mesh->getDim();
     checkFinleyError();  
     return numDim;  
633  }  }
634    
635  //  //
# Line 650  pair<int,int> MeshAdapter::getDataShape( Line 648  pair<int,int> MeshAdapter::getDataShape(
648  {  {
649      int numDataPointsPerSample=0;      int numDataPointsPerSample=0;
650      int numSamples=0;      int numSamples=0;
651      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
652      switch (functionSpaceCode) {      switch (functionSpaceCode) {
653          case Nodes:          case Nodes:
654              numDataPointsPerSample=1;              numDataPointsPerSample=1;
# Line 751  void MeshAdapter::addPDEToSystem( Line 749  void MeshAdapter::addPDEToSystem(
749      if (!smat)      if (!smat)
750          throw FinleyAdapterException("finley only supports Paso system matrices.");          throw FinleyAdapterException("finley only supports Paso system matrices.");
751    
752      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
753      Paso_SystemMatrix* S = smat->getPaso_SystemMatrix();      Paso_SystemMatrix* S = smat->getPaso_SystemMatrix();
754      Assemble_PDE(mesh->Nodes, mesh->Elements, S, rhs, A, B, C, D, X, Y);      Assemble_PDE(mesh->Nodes, mesh->Elements, S, rhs, A, B, C, D, X, Y);
755      checkFinleyError();      checkFinleyError();
# Line 775  void MeshAdapter::addPDEToLumpedSystem(e Line 773  void MeshAdapter::addPDEToLumpedSystem(e
773          const escript::Data& D, const escript::Data& d,          const escript::Data& D, const escript::Data& d,
774          const escript::Data& d_dirac, const bool useHRZ) const          const escript::Data& d_dirac, const bool useHRZ) const
775  {  {
776      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
777      Assemble_LumpedSystem(mesh->Nodes, mesh->Elements, mat, D, useHRZ);      Assemble_LumpedSystem(mesh->Nodes, mesh->Elements, mat, D, useHRZ);
778      checkFinleyError();      checkFinleyError();
779    
# Line 793  void MeshAdapter::addPDEToRHS(escript::D Line 791  void MeshAdapter::addPDEToRHS(escript::D
791          const escript::Data& Y, const escript::Data& y,          const escript::Data& Y, const escript::Data& y,
792          const escript::Data& y_contact, const escript::Data& y_dirac) const          const escript::Data& y_contact, const escript::Data& y_dirac) const
793  {  {
794      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
795      Assemble_PDE(mesh->Nodes, mesh->Elements, 0, rhs,      Assemble_PDE(mesh->Nodes, mesh->Elements, 0, rhs,
796              escript::Data(), escript::Data(), escript::Data(), escript::Data(),              escript::Data(), escript::Data(), escript::Data(), escript::Data(),
797              X, Y);              X, Y);
# Line 832  void MeshAdapter::addPDEToTransportProbl Line 830  void MeshAdapter::addPDEToTransportProbl
830    
831      source.expand();      source.expand();
832    
833      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
834      Paso_TransportProblem* _tp = tpa->getPaso_TransportProblem();      Paso_TransportProblem* _tp = tpa->getPaso_TransportProblem();
835    
836      Assemble_PDE(mesh->Nodes, mesh->Elements, _tp->mass_matrix, source,      Assemble_PDE(mesh->Nodes, mesh->Elements, _tp->mass_matrix, source,
# Line 873  void MeshAdapter::interpolateOnDomain(es Line 871  void MeshAdapter::interpolateOnDomain(es
871      if (targetDomain!=*this)      if (targetDomain!=*this)
872          throw FinleyAdapterException("Error - Illegal domain of interpolation target.");          throw FinleyAdapterException("Error - Illegal domain of interpolation target.");
873    
874      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
875      switch(in.getFunctionSpace().getTypeCode()) {      switch(in.getFunctionSpace().getTypeCode()) {
876          case Nodes:          case Nodes:
877              switch(target.getFunctionSpace().getTypeCode()) {              switch(target.getFunctionSpace().getTypeCode()) {
# Line 1135  void MeshAdapter::setToX(escript::Data& Line 1133  void MeshAdapter::setToX(escript::Data&
1133      const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));      const MeshAdapter& argDomain=dynamic_cast<const MeshAdapter&>(*(arg.getFunctionSpace().getDomain()));
1134      if (argDomain!=*this)      if (argDomain!=*this)
1135          throw FinleyAdapterException("Error - Illegal domain of data point locations");          throw FinleyAdapterException("Error - Illegal domain of data point locations");
1136      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1137      // in case of appropriate function space we can do the job directly:      // in case of appropriate function space we can do the job directly:
1138      if (arg.getFunctionSpace().getTypeCode()==Nodes) {      if (arg.getFunctionSpace().getTypeCode()==Nodes) {
1139          Assemble_NodeCoordinates(mesh->Nodes, arg);          Assemble_NodeCoordinates(mesh->Nodes, arg);
# Line 1156  void MeshAdapter::setToNormal(escript::D Line 1154  void MeshAdapter::setToNormal(escript::D
1154      const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(*(normal.getFunctionSpace().getDomain()));      const MeshAdapter& normalDomain=dynamic_cast<const MeshAdapter&>(*(normal.getFunctionSpace().getDomain()));
1155      if (normalDomain!=*this)      if (normalDomain!=*this)
1156          throw FinleyAdapterException("Error - Illegal domain of normal locations");          throw FinleyAdapterException("Error - Illegal domain of normal locations");
1157      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1158      switch(normal.getFunctionSpace().getTypeCode()) {      switch(normal.getFunctionSpace().getTypeCode()) {
1159          case Nodes:          case Nodes:
1160              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for nodes");
# Line 1172  void MeshAdapter::setToNormal(escript::D Line 1170  void MeshAdapter::setToNormal(escript::D
1170              break;              break;
1171          case FaceElements:          case FaceElements:
1172          case ReducedFaceElements:          case ReducedFaceElements:
1173              Assemble_setNormal(mesh->Nodes, mesh->FaceElements, normal);              Assemble_getNormal(mesh->Nodes, mesh->FaceElements, normal);
1174              break;              break;
1175          case Points:          case Points:
1176              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for point elements");              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for point elements");
# Line 1181  void MeshAdapter::setToNormal(escript::D Line 1179  void MeshAdapter::setToNormal(escript::D
1179          case ContactElementsZero:          case ContactElementsZero:
1180          case ReducedContactElementsOne:          case ReducedContactElementsOne:
1181          case ReducedContactElementsZero:          case ReducedContactElementsZero:
1182              Assemble_setNormal(mesh->Nodes, mesh->ContactElements, normal);              Assemble_getNormal(mesh->Nodes, mesh->ContactElements, normal);
1183              break;              break;
1184          case DegreesOfFreedom:          case DegreesOfFreedom:
1185              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for degrees of freedom.");              throw FinleyAdapterException("Error - Finley does not support surface normal vectors for degrees of freedom.");
# Line 1216  void MeshAdapter::setToIntegrals(vector< Line 1214  void MeshAdapter::setToIntegrals(vector<
1214          throw FinleyAdapterException("Error - Illegal domain of integration kernel");          throw FinleyAdapterException("Error - Illegal domain of integration kernel");
1215    
1216      double blocktimer_start = blocktimer_time();      double blocktimer_start = blocktimer_time();
1217      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1218      switch(arg.getFunctionSpace().getTypeCode()) {      switch(arg.getFunctionSpace().getTypeCode()) {
1219          case Nodes:          case Nodes:
1220              {              {
# Line 1276  void MeshAdapter::setToGradient(escript: Line 1274  void MeshAdapter::setToGradient(escript:
1274      if (gradDomain!=*this)      if (gradDomain!=*this)
1275          throw FinleyAdapterException("Error - Illegal domain of gradient");          throw FinleyAdapterException("Error - Illegal domain of gradient");
1276    
1277      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1278      escript::Data nodeData;      escript::Data nodeData;
1279      if (getMPISize()>1) {      if (getMPISize()>1) {
1280          if (arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom) {          if (arg.getFunctionSpace().getTypeCode() == DegreesOfFreedom) {
# Line 1333  void MeshAdapter::setToGradient(escript: Line 1331  void MeshAdapter::setToGradient(escript:
1331  //  //
1332  void MeshAdapter::setToSize(escript::Data& size) const  void MeshAdapter::setToSize(escript::Data& size) const
1333  {  {
1334      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1335      switch(size.getFunctionSpace().getTypeCode()) {      switch(size.getFunctionSpace().getTypeCode()) {
1336          case Nodes:          case Nodes:
1337              throw FinleyAdapterException("Error - Size of nodes is not supported.");              throw FinleyAdapterException("Error - Size of nodes is not supported.");
# Line 1378  void MeshAdapter::setToSize(escript::Dat Line 1376  void MeshAdapter::setToSize(escript::Dat
1376  //  //
1377  void MeshAdapter::setNewX(const escript::Data& new_x)  void MeshAdapter::setNewX(const escript::Data& new_x)
1378  {  {
1379      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1380      const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(*(new_x.getFunctionSpace().getDomain()));      const MeshAdapter& newDomain=dynamic_cast<const MeshAdapter&>(*(new_x.getFunctionSpace().getDomain()));
1381      if (newDomain!=*this)      if (newDomain!=*this)
1382          throw FinleyAdapterException("Error - Illegal domain of new point locations");          throw FinleyAdapterException("Error - Illegal domain of new point locations");
1383      if (new_x.getFunctionSpace() == continuousFunction(*this)) {      if (new_x.getFunctionSpace() == continuousFunction(*this)) {
1384          Finley_Mesh_setCoordinates(mesh, new_x);          mesh->setCoordinates(new_x);
1385      } else {      } else {
1386          throw FinleyAdapterException("As of escript version 3.3 SetX() only accepts ContinuousFunction arguments. Please interpolate.");          throw FinleyAdapterException("As of escript version 3.3 SetX() only accepts ContinuousFunction arguments. Please interpolate.");
1387      }      }
# Line 1396  bool MeshAdapter::ownSample(int fs_code, Line 1394  bool MeshAdapter::ownSample(int fs_code,
1394  #ifdef ESYS_MPI  #ifdef ESYS_MPI
1395          int myFirstNode=0, myLastNode=0, k=0;          int myFirstNode=0, myLastNode=0, k=0;
1396          int* globalNodeIndex=0;          int* globalNodeIndex=0;
1397          Finley_Mesh* mesh_p=m_finleyMesh.get();          Mesh* mesh_p=m_finleyMesh.get();
1398          /*          /*
1399           * this method is only used by saveDataCSV which would use the returned           * this method is only used by saveDataCSV which would use the returned
1400           * values for reduced nodes wrongly so this case is disabled for now           * values for reduced nodes wrongly so this case is disabled for now
1401          if (fs_code == FINLEY_REDUCED_NODES) {          if (fs_code == FINLEY_REDUCED_NODES) {
1402              myFirstNode = Finley_NodeFile_getFirstReducedNode(mesh_p->Nodes);              myFirstNode = NodeFile_getFirstReducedNode(mesh_p->Nodes);
1403              myLastNode = Finley_NodeFile_getLastReducedNode(mesh_p->Nodes);              myLastNode = NodeFile_getLastReducedNode(mesh_p->Nodes);
1404              globalNodeIndex = Finley_NodeFile_borrowGlobalReducedNodesIndex(mesh_p->Nodes);              globalNodeIndex = NodeFile_borrowGlobalReducedNodesIndex(mesh_p->Nodes);
1405          } else          } else
1406          */          */
1407          if (fs_code == FINLEY_NODES) {          if (fs_code == FINLEY_NODES) {
# Line 1454  escript::ASM_ptr MeshAdapter::newSystemM Line 1452  escript::ASM_ptr MeshAdapter::newSystemM
1452      }      }
1453    
1454      // generate matrix:      // generate matrix:
1455      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(      Paso_SystemMatrixPattern* fsystemMatrixPattern=
1456              getFinley_Mesh(), reduceRowOrder, reduceColOrder);          getFinley_Mesh()->getPattern(reduceRowOrder, reduceColOrder);
1457      checkFinleyError();      checkFinleyError();
1458      Paso_SystemMatrix* fsystemMatrix;      Paso_SystemMatrix* fsystemMatrix;
1459      const int trilinos = 0;      const int trilinos = 0;
# Line 1493  escript::ATP_ptr MeshAdapter::newTranspo Line 1491  escript::ATP_ptr MeshAdapter::newTranspo
1491      }      }
1492    
1493      // generate transport problem:      // generate transport problem:
1494      Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(      Paso_SystemMatrixPattern* fsystemMatrixPattern=
1495              getFinley_Mesh(), reduceOrder, reduceOrder);          getFinley_Mesh()->getPattern(reduceOrder, reduceOrder);
1496      checkFinleyError();      checkFinleyError();
1497      Paso_TransportProblem* transportProblem;      Paso_TransportProblem* transportProblem;
1498      transportProblem=Paso_TransportProblem_alloc(fsystemMatrixPattern, blocksize);      transportProblem=Paso_TransportProblem_alloc(fsystemMatrixPattern, blocksize);
# Line 1845  bool MeshAdapter::operator!=(const escri Line 1843  bool MeshAdapter::operator!=(const escri
1843    
1844  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const  int MeshAdapter::getSystemMatrixTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const
1845  {  {
1846      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1847      return SystemMatrixAdapter::getSystemMatrixTypeId(solver, preconditioner,      return SystemMatrixAdapter::getSystemMatrixTypeId(solver, preconditioner,
1848                 package, symmetry, mesh->MPIInfo);                 package, symmetry, mesh->MPIInfo);
1849  }  }
1850    
1851  int MeshAdapter::getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const  int MeshAdapter::getTransportTypeId(const int solver, const int preconditioner, const int package, const bool symmetry) const
1852  {  {
1853      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1854      return TransportProblemAdapter::getTransportTypeId(solver, preconditioner,      return TransportProblemAdapter::getTransportTypeId(solver, preconditioner,
1855                  package, symmetry, mesh->MPIInfo);                  package, symmetry, mesh->MPIInfo);
1856  }  }
# Line 1875  escript::Data MeshAdapter::getSize() con Line 1873  escript::Data MeshAdapter::getSize() con
1873  const int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const  const int* MeshAdapter::borrowSampleReferenceIDs(int functionSpaceType) const
1874  {  {
1875      int *out = NULL;      int *out = NULL;
1876      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1877      switch (functionSpaceType) {      switch (functionSpaceType) {
1878          case Nodes:          case Nodes:
1879              out=mesh->Nodes->Id;              out=mesh->Nodes->Id;
# Line 1917  const int* MeshAdapter::borrowSampleRefe Line 1915  const int* MeshAdapter::borrowSampleRefe
1915  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const  int MeshAdapter::getTagFromSampleNo(int functionSpaceType, int sampleNo) const
1916  {  {
1917      int out=0;      int out=0;
1918      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1919      switch (functionSpaceType) {      switch (functionSpaceType) {
1920          case Nodes:          case Nodes:
1921              out=mesh->Nodes->Tag[sampleNo];              out=mesh->Nodes->Tag[sampleNo];
# Line 1960  int MeshAdapter::getTagFromSampleNo(int Line 1958  int MeshAdapter::getTagFromSampleNo(int
1958    
1959  void MeshAdapter::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const  void MeshAdapter::setTags(const int functionSpaceType, const int newTag, const escript::Data& mask) const
1960  {  {
1961      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
1962      switch(functionSpaceType) {      switch(functionSpaceType) {
1963          case Nodes:          case Nodes:
1964              mesh->Nodes->setTags(newTag, mask);              mesh->Nodes->setTags(newTag, mask);
# Line 1998  void MeshAdapter::setTags(const int func Line 1996  void MeshAdapter::setTags(const int func
1996    
1997  void MeshAdapter::setTagMap(const string& name, int tag)  void MeshAdapter::setTagMap(const string& name, int tag)
1998  {  {
1999      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2000      Finley_Mesh_addTagMap(mesh, name.c_str(), tag);      mesh->addTagMap(name.c_str(), tag);
2001      checkFinleyError();      checkFinleyError();
2002  }  }
2003    
2004  int MeshAdapter::getTag(const string& name) const  int MeshAdapter::getTag(const string& name) const
2005  {  {
2006      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2007      int tag = Finley_Mesh_getTag(mesh, name.c_str());      int tag = mesh->getTag(name.c_str());
2008      checkFinleyError();      checkFinleyError();
2009      return tag;      return tag;
2010  }  }
2011    
2012  bool MeshAdapter::isValidTagName(const string& name) const  bool MeshAdapter::isValidTagName(const string& name) const
2013  {  {
2014      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2015      return Finley_Mesh_isValidTagName(mesh, name.c_str());      return mesh->isValidTagName(name.c_str());
2016  }  }
2017    
2018  string MeshAdapter::showTagNames() const  string MeshAdapter::showTagNames() const
2019  {  {
2020      stringstream temp;      stringstream temp;
2021      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2022      TagMap::const_iterator it = mesh->tagMap.begin();      TagMap::const_iterator it = mesh->tagMap.begin();
2023      while (it != mesh->tagMap.end()) {      while (it != mesh->tagMap.end()) {
2024          temp << it->first;          temp << it->first;
# Line 2033  string MeshAdapter::showTagNames() const Line 2031  string MeshAdapter::showTagNames() const
2031    
2032  int MeshAdapter::getNumberOfTagsInUse(int functionSpaceCode) const  int MeshAdapter::getNumberOfTagsInUse(int functionSpaceCode) const
2033  {  {
2034      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2035      switch(functionSpaceCode) {      switch(functionSpaceCode) {
2036          case Nodes:          case Nodes:
2037              return mesh->Nodes->tagsInUse.size();              return mesh->Nodes->tagsInUse.size();
# Line 2067  int MeshAdapter::getNumberOfTagsInUse(in Line 2065  int MeshAdapter::getNumberOfTagsInUse(in
2065    
2066  const int* MeshAdapter::borrowListOfTagsInUse(int functionSpaceCode) const  const int* MeshAdapter::borrowListOfTagsInUse(int functionSpaceCode) const
2067  {  {
2068      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2069      switch(functionSpaceCode) {      switch(functionSpaceCode) {
2070          case Nodes:          case Nodes:
2071              return &mesh->Nodes->tagsInUse[0];              return &mesh->Nodes->tagsInUse[0];
# Line 2120  bool MeshAdapter::canTag(int functionSpa Line 2118  bool MeshAdapter::canTag(int functionSpa
2118    
2119  escript::AbstractDomain::StatusType MeshAdapter::getStatus() const  escript::AbstractDomain::StatusType MeshAdapter::getStatus() const
2120  {  {
2121      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2122      return Finley_Mesh_getStatus(mesh);      return mesh->getStatus();
2123  }  }
2124    
2125  int MeshAdapter::getApproximationOrder(const int functionSpaceCode) const  int MeshAdapter::getApproximationOrder(const int functionSpaceCode) const
2126  {  {
2127      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2128      int order =-1;      int order =-1;
2129      switch(functionSpaceCode) {      switch(functionSpaceCode) {
2130          case Nodes:          case Nodes:
# Line 2163  bool MeshAdapter::supportsContactElement Line 2161  bool MeshAdapter::supportsContactElement
2161      return true;      return true;
2162  }  }
2163    
 ReferenceElementSetWrapper::ReferenceElementSetWrapper(Finley_ElementTypeId id,  
         index_t order, index_t reducedOrder)  
 {  
     m_refSet = Finley_ReferenceElementSet_alloc(id, order, reducedOrder);  
 }  
   
 ReferenceElementSetWrapper::~ReferenceElementSetWrapper()  
 {  
     Finley_ReferenceElementSet_dealloc(m_refSet);  
 }  
   
2164  void MeshAdapter::addDiracPoints(const vector<double>& points,  void MeshAdapter::addDiracPoints(const vector<double>& points,
2165                                   const vector<int>& tags) const                                   const vector<int>& tags) const
2166  {  {
# Line 2181  void MeshAdapter::addDiracPoints(const v Line 2168  void MeshAdapter::addDiracPoints(const v
2168      const int dim = getDim();      const int dim = getDim();
2169      int numPoints=points.size()/dim;      int numPoints=points.size()/dim;
2170      int numTags=tags.size();      int numTags=tags.size();
2171      Finley_Mesh* mesh=m_finleyMesh.get();      Mesh* mesh=m_finleyMesh.get();
2172    
2173      if ( points.size() % dim != 0 ) {      if ( points.size() % dim != 0 ) {
2174          throw FinleyAdapterException("Error - number of coords does not appear to be a multiple of dimension.");          throw FinleyAdapterException("Error - number of coords does not appear to be a multiple of dimension.");
# Line 2190  void MeshAdapter::addDiracPoints(const v Line 2177  void MeshAdapter::addDiracPoints(const v
2177      if ((numTags > 0) && (numPoints != numTags))      if ((numTags > 0) && (numPoints != numTags))
2178          throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");          throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");
2179    
2180      Finley_Mesh_addPoints(mesh, numPoints, &points[0], &tags[0]);      mesh->addPoints(numPoints, &points[0], &tags[0]);
2181      checkFinleyError();      checkFinleyError();
2182  }  }
2183    
# Line 2199  void MeshAdapter::addDiracPoints(const v Line 2186  void MeshAdapter::addDiracPoints(const v
2186  //       const int dim = getDim();  //       const int dim = getDim();
2187  //       int numPoints=boost::python::extract<int>(points.attr("__len__")());  //       int numPoints=boost::python::extract<int>(points.attr("__len__")());
2188  //       int numTags=boost::python::extract<int>(tags.attr("__len__")());  //       int numTags=boost::python::extract<int>(tags.attr("__len__")());
2189  //       Finley_Mesh* mesh=m_finleyMesh.get();  //       Mesh* mesh=m_finleyMesh.get();
2190  //  //
2191  //       if  ( (numTags > 0) && ( numPoints !=  numTags ) )  //       if  ( (numTags > 0) && ( numPoints !=  numTags ) )
2192  //       throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");  //       throw FinleyAdapterException("Error - if tags are given number of tags and points must match.");

Legend:
Removed from v.4441  
changed lines
  Added in v.4496

  ViewVC Help
Powered by ViewVC 1.1.26