/[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 1343 by ksteube, Wed Nov 14 02:48:02 2007 UTC revision 1407 by gross, Mon Feb 4 06:45:48 2008 UTC
# Line 104  void MeshAdapter::Print_Mesh_Info(const Line 104  void MeshAdapter::Print_Mesh_Info(const
104  void MeshAdapter::dump(const std::string& fileName) const  void MeshAdapter::dump(const std::string& fileName) const
105  {  {
106  #ifdef USE_NETCDF  #ifdef USE_NETCDF
107     const NcDim* ncdims[25]; /* ksteube how big should ncdims be? */     const NcDim* ncdims[12];
108     NcVar *ids, *data;     NcVar *ids, *data;
109     int *int_ptr;     int *int_ptr;
110     Finley_Mesh *mesh = m_finleyMesh.get();     Finley_Mesh *mesh = m_finleyMesh.get();
111       Finley_TagMap* tag_map;
112       int num_Tags = 0;
113     int mpi_size             = mesh->MPIInfo->size;     int mpi_size             = mesh->MPIInfo->size;
114     int mpi_rank             = mesh->MPIInfo->rank;     int mpi_rank             = mesh->MPIInfo->rank;
115     int numDim               = mesh->Nodes->numDim;     int numDim               = mesh->Nodes->numDim;
# Line 121  void MeshAdapter::dump(const std::string Line 123  void MeshAdapter::dump(const std::string
123     int num_ContactElements_numNodes = mesh->ContactElements->numNodes;     int num_ContactElements_numNodes = mesh->ContactElements->numNodes;
124     char *newFileName = Paso_MPI_appendRankToFileName(strdup(fileName.c_str()), mpi_size, mpi_rank);     char *newFileName = Paso_MPI_appendRankToFileName(strdup(fileName.c_str()), mpi_size, mpi_rank);
125    
126       /* Figure out how much storage is required for tags */
127       tag_map = mesh->TagMap;
128       if (tag_map) {
129         while (tag_map) {
130        num_Tags++;
131            tag_map=tag_map->next;
132         }
133       }
134    
135     // NetCDF error handler     // NetCDF error handler
136     NcError err(NcError::verbose_nonfatal);     NcError err(NcError::verbose_nonfatal);
137     // Create the file.     // Create the file.
# Line 157  void MeshAdapter::dump(const std::string Line 168  void MeshAdapter::dump(const std::string
168     if (num_ContactElements>0)     if (num_ContactElements>0)
169        if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )        if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )
170          throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements_numNodes to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending dimension dim_ContactElements_numNodes to netCDF file failed: " + *newFileName);
171       if (num_Tags>0)
172          if (! (ncdims[10] = dataFile.add_dim("dim_Tags", num_Tags)) )
173            throw DataException("Error - MeshAdapter::dump: appending dimension dim_Tags to netCDF file failed: " + *newFileName);
174    
175     // MPI size, MPI rank, Name, order, reduced_order     // Attributes: MPI size, MPI rank, Name, order, reduced_order
176     if (!dataFile.add_att("mpi_size", mpi_size) )     if (!dataFile.add_att("mpi_size", mpi_size) )
177          throw DataException("Error - MeshAdapter::dump: appending mpi_size to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending mpi_size to NetCDF file failed: " + *newFileName);
178     if (!dataFile.add_att("mpi_rank", mpi_rank) )     if (!dataFile.add_att("mpi_rank", mpi_rank) )
179          throw DataException("Error - MeshAdapter::dump: appending mpi_rank to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending mpi_rank to NetCDF file failed: " + *newFileName);
180     if (!dataFile.add_att("Name",mesh->Name) )     if (!dataFile.add_att("Name",mesh->Name) )
181          throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);
182       if (!dataFile.add_att("numDim",numDim) )
183            throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
184     if (!dataFile.add_att("order",mesh->order) )     if (!dataFile.add_att("order",mesh->order) )
185          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
186     if (!dataFile.add_att("reduced_order",mesh->reduced_order) )     if (!dataFile.add_att("reduced_order",mesh->reduced_order) )
187          throw DataException("Error - MeshAdapter::dump: appending reduced_order to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending reduced_order to NetCDF file failed: " + *newFileName);
188       if (!dataFile.add_att("numNodes",numNodes) )
189            throw DataException("Error - MeshAdapter::dump: appending numNodes to NetCDF file failed: " + *newFileName);
190     if (!dataFile.add_att("num_Elements",num_Elements) )     if (!dataFile.add_att("num_Elements",num_Elements) )
191          throw DataException("Error - MeshAdapter::dump: appending num_Elements to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending num_Elements to NetCDF file failed: " + *newFileName);
192     if (!dataFile.add_att("num_FaceElements",num_FaceElements) )     if (!dataFile.add_att("num_FaceElements",num_FaceElements) )
# Line 177  void MeshAdapter::dump(const std::string Line 195  void MeshAdapter::dump(const std::string
195          throw DataException("Error - MeshAdapter::dump: appending num_ContactElements to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending num_ContactElements to NetCDF file failed: " + *newFileName);
196     if (!dataFile.add_att("num_Points",num_Points) )     if (!dataFile.add_att("num_Points",num_Points) )
197          throw DataException("Error - MeshAdapter::dump: appending num_Points to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending num_Points to NetCDF file failed: " + *newFileName);
198       if (!dataFile.add_att("num_Elements_numNodes",num_Elements_numNodes) )
199            throw DataException("Error - MeshAdapter::dump: appending num_Elements_numNodes to NetCDF file failed: " + *newFileName);
200       if (!dataFile.add_att("num_FaceElements_numNodes",num_FaceElements_numNodes) )
201            throw DataException("Error - MeshAdapter::dump: appending num_FaceElements_numNodes to NetCDF file failed: " + *newFileName);
202       if (!dataFile.add_att("num_ContactElements_numNodes",num_ContactElements_numNodes) )
203            throw DataException("Error - MeshAdapter::dump: appending num_ContactElements_numNodes to NetCDF file failed: " + *newFileName);
204       if (!dataFile.add_att("Elements_TypeId", mesh->Elements->ReferenceElement->Type->TypeId) )
205          throw DataException("Error - MeshAdapter::dump: appending Elements_TypeId to NetCDF file failed: " + *newFileName);
206       if (!dataFile.add_att("FaceElements_TypeId", mesh->FaceElements->ReferenceElement->Type->TypeId) )
207          throw DataException("Error - MeshAdapter::dump: appending FaceElements_TypeId to NetCDF file failed: " + *newFileName);
208       if (!dataFile.add_att("ContactElements_TypeId", mesh->ContactElements->ReferenceElement->Type->TypeId) )
209          throw DataException("Error - MeshAdapter::dump: appending ContactElements_TypeId to NetCDF file failed: " + *newFileName);
210       if (!dataFile.add_att("Points_TypeId", mesh->Points->ReferenceElement->Type->TypeId) )
211          throw DataException("Error - MeshAdapter::dump: appending Points_TypeId to NetCDF file failed: " + *newFileName);
212       if (!dataFile.add_att("num_Tags", num_Tags) )
213          throw DataException("Error - MeshAdapter::dump: appending num_Tags to NetCDF file failed: " + *newFileName);
214    
215     // // // // // Nodes // // // // //     // // // // // Nodes // // // // //
216    
217       // Only write nodes if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)
218       if (numNodes>0) {
219    
220     // Nodes Id     // Nodes Id
221     if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )     if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )
222          throw DataException("Error - MeshAdapter::dump: appending Nodes_Id to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending Nodes_Id to netCDF file failed: " + *newFileName);
# Line 235  void MeshAdapter::dump(const std::string Line 272  void MeshAdapter::dump(const std::string
272     if (! (ids->put(int_ptr, mpi_size+1)) )     if (! (ids->put(int_ptr, mpi_size+1)) )
273          throw DataException("Error - MeshAdapter::dump: copy Nodes_DofDistribution to netCDF buffer failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: copy Nodes_DofDistribution to netCDF buffer failed: " + *newFileName);
274    
275       }
276    
277     // // // // // Elements // // // // //     // // // // // Elements // // // // //
278    
    // Only write elements if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)  
279     if (num_Elements>0) {     if (num_Elements>0) {
280    
281       // Temp storage to gather node IDs       // Temp storage to gather node IDs
282       int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);       int *Elements_Nodes = TMPMEMALLOC(num_Elements*num_Elements_numNodes,int);
283    
      // Elements ReferenceElement->ElementTypeId  
      if (!dataFile.add_att("Elements_TypeId", mesh->Elements->ReferenceElement->Type->TypeId) )  
         throw DataException("Error - MeshAdapter::dump: appending Elements_TypeId to NetCDF file failed: " + *newFileName);  
   
284       // Elements_Id       // Elements_Id
285       if (! ( ids = dataFile.add_var("Elements_Id", ncInt, ncdims[3])) )       if (! ( ids = dataFile.add_var("Elements_Id", ncInt, ncdims[3])) )
286          throw DataException("Error - MeshAdapter::dump: appending Elements_Id to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending Elements_Id to netCDF file failed: " + *newFileName);
# Line 284  void MeshAdapter::dump(const std::string Line 318  void MeshAdapter::dump(const std::string
318       if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )       if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )
319          throw DataException("Error - MeshAdapter::dump: copy Elements_Nodes to netCDF buffer failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: copy Elements_Nodes to netCDF buffer failed: " + *newFileName);
320    
321         TMPMEMFREE(Elements_Nodes);
322    
323     }     }
324    
325     // // // // // Face_Elements // // // // //     // // // // // Face_Elements // // // // //
# Line 293  void MeshAdapter::dump(const std::string Line 329  void MeshAdapter::dump(const std::string
329       // Temp storage to gather node IDs       // Temp storage to gather node IDs
330       int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);       int *FaceElements_Nodes = TMPMEMALLOC(num_FaceElements*num_FaceElements_numNodes,int);
331    
      // FaceElements ReferenceElement->ElementTypeId  
      if (!dataFile.add_att("FaceElements_TypeId", mesh->FaceElements->ReferenceElement->Type->TypeId) )  
         throw DataException("Error - MeshAdapter::dump: appending FaceElements_TypeId to NetCDF file failed: " + *newFileName);  
   
332       // FaceElements_Id       // FaceElements_Id
333       if (! ( ids = dataFile.add_var("FaceElements_Id", ncInt, ncdims[4])) )       if (! ( ids = dataFile.add_var("FaceElements_Id", ncInt, ncdims[4])) )
334          throw DataException("Error - MeshAdapter::dump: appending FaceElements_Id to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending FaceElements_Id to netCDF file failed: " + *newFileName);
# Line 334  void MeshAdapter::dump(const std::string Line 366  void MeshAdapter::dump(const std::string
366       if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )       if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )
367          throw DataException("Error - MeshAdapter::dump: copy FaceElements_Nodes to netCDF buffer failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: copy FaceElements_Nodes to netCDF buffer failed: " + *newFileName);
368    
369         TMPMEMFREE(FaceElements_Nodes);
370    
371     }     }
372    
373     // // // // // Contact_Elements // // // // //     // // // // // Contact_Elements // // // // //
# Line 343  void MeshAdapter::dump(const std::string Line 377  void MeshAdapter::dump(const std::string
377       // Temp storage to gather node IDs       // Temp storage to gather node IDs
378       int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);       int *ContactElements_Nodes = TMPMEMALLOC(num_ContactElements*num_ContactElements_numNodes,int);
379    
      // ContactElements ReferenceElement->ElementTypeId  
      if (!dataFile.add_att("ContactElements_TypeId", mesh->ContactElements->ReferenceElement->Type->TypeId) )  
         throw DataException("Error - MeshAdapter::dump: appending ContactElements_TypeId to NetCDF file failed: " + *newFileName);  
   
380       // ContactElements_Id       // ContactElements_Id
381       if (! ( ids = dataFile.add_var("ContactElements_Id", ncInt, ncdims[5])) )       if (! ( ids = dataFile.add_var("ContactElements_Id", ncInt, ncdims[5])) )
382          throw DataException("Error - MeshAdapter::dump: appending ContactElements_Id to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending ContactElements_Id to netCDF file failed: " + *newFileName);
# Line 384  void MeshAdapter::dump(const std::string Line 414  void MeshAdapter::dump(const std::string
414       if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )       if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )
415          throw DataException("Error - MeshAdapter::dump: copy ContactElements_Nodes to netCDF buffer failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: copy ContactElements_Nodes to netCDF buffer failed: " + *newFileName);
416    
417         TMPMEMFREE(ContactElements_Nodes);
418    
419     }     }
420    
421     // // // // // Points // // // // //     // // // // // Points // // // // //
# Line 395  void MeshAdapter::dump(const std::string Line 427  void MeshAdapter::dump(const std::string
427       // Temp storage to gather node IDs       // Temp storage to gather node IDs
428       int *Points_Nodes = TMPMEMALLOC(num_Points,int);       int *Points_Nodes = TMPMEMALLOC(num_Points,int);
429    
      // Points ReferenceElement->ElementTypeId  
      if (!dataFile.add_att("Points_TypeId", mesh->Points->ReferenceElement->Type->TypeId) )  
         throw DataException("Error - MeshAdapter::dump: appending Points_TypeId to NetCDF file failed: " + *newFileName);  
   
430       // Points_Id       // Points_Id
431       if (! ( ids = dataFile.add_var("Points_Id", ncInt, ncdims[6])) )       if (! ( ids = dataFile.add_var("Points_Id", ncInt, ncdims[6])) )
432          throw DataException("Error - MeshAdapter::dump: appending Points_Id to netCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending Points_Id to netCDF file failed: " + *newFileName);
# Line 436  void MeshAdapter::dump(const std::string Line 464  void MeshAdapter::dump(const std::string
464       if (! (ids->put(&(Points_Nodes[0]), num_Points)) )       if (! (ids->put(&(Points_Nodes[0]), num_Points)) )
465          throw DataException("Error - MeshAdapter::dump: copy Points_Nodes to netCDF buffer failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: copy Points_Nodes to netCDF buffer failed: " + *newFileName);
466    
467         TMPMEMFREE(Points_Nodes);
468    
469     }     }
470    
471     // // // // // TagMap // // // // //     // // // // // TagMap // // // // //
472    
473       fprintf(stderr, "\n\n\nWARNING: MeshAdapter::dump does not save the TagMap yet\n\n\n");     if (num_Tags>0) {
474    
475         // Temp storage to gather node IDs
476         int *Tags_keys = TMPMEMALLOC(num_Tags, int);
477         char name_temp[4096];
478    
479         /* Copy tag data into temp arrays */
480         tag_map = mesh->TagMap;
481         if (tag_map) {
482           int i = 0;
483           while (tag_map) {
484        Tags_keys[i++] = tag_map->tag_key;
485            tag_map=tag_map->next;
486           }
487         }
488    
489         // Tags_keys
490         if (! ( ids = dataFile.add_var("Tags_keys", ncInt, ncdims[10])) )
491            throw DataException("Error - MeshAdapter::dump: appending Tags_keys to netCDF file failed: " + *newFileName);
492         int_ptr = &Tags_keys[0];
493         if (! (ids->put(int_ptr, num_Tags)) )
494            throw DataException("Error - MeshAdapter::dump: copy Tags_keys to netCDF buffer failed: " + *newFileName);
495    
496         // Tags_names_*
497         // This is an array of strings, it should be stored as an array but instead I have hacked in one attribute per string
498         // because the NetCDF manual doesn't tell how to do an array of strings
499         tag_map = mesh->TagMap;
500         if (tag_map) {
501           int i = 0;
502           while (tag_map) {
503             sprintf(name_temp, "Tags_name_%d", i);
504             if (!dataFile.add_att(name_temp, tag_map->name) )
505               throw DataException("Error - MeshAdapter::dump: appending Tags_names_ to NetCDF file failed: " + *newFileName);
506             tag_map=tag_map->next;
507         i++;
508           }
509         }
510    
511         TMPMEMFREE(Tags_keys);
512    
513       }
514    
515    
516     // NetCDF file is closed by destructor of NcFile object     // NetCDF file is closed by destructor of NcFile object
517  #else  #else
# Line 738  void MeshAdapter::addPDEToRHS( escript:: Line 809  void MeshAdapter::addPDEToRHS( escript::
809     Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, 0, &_rhs , 0, 0, 0, 0, 0, &_y_contact );     Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, 0, &_rhs , 0, 0, 0, 0, 0, &_y_contact );
810     checkFinleyError();     checkFinleyError();
811  }  }
812    //
813    // adds PDE of second order into a transport problem
814    //
815    void MeshAdapter::addPDEToTransportProblem(
816                         TransportProblemAdapter& tp, escript::Data& source, const escript::Data& M,
817                         const escript::Data& A, const escript::Data& B, const escript::Data& C,
818                         const  escript::Data& D,const  escript::Data& X,const  escript::Data& Y,
819                         const escript::Data& d, const escript::Data& y,
820                         const escript::Data& d_contact,const escript::Data& y_contact) const
821    {
822       DataArrayView::ShapeType shape;
823       source.expand();
824       escriptDataC _source=source.getDataC();
825       escriptDataC _M=M.getDataC();
826       escriptDataC _A=A.getDataC();
827       escriptDataC _B=B.getDataC();
828       escriptDataC _C=C.getDataC();
829       escriptDataC _D=D.getDataC();
830       escriptDataC _X=X.getDataC();
831       escriptDataC _Y=Y.getDataC();
832       escriptDataC _d=d.getDataC();
833       escriptDataC _y=y.getDataC();
834       escriptDataC _d_contact=d_contact.getDataC();
835       escriptDataC _y_contact=y_contact.getDataC();
836    
837       Finley_Mesh* mesh=m_finleyMesh.get();
838       Paso_FCTransportProblem* _tp = tp.getPaso_FCTransportProblem();
839      
840       Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,_tp->mass_matrix, &_source, 0, 0, 0, &_M, 0, 0 );
841       checkFinleyError();
842    
843       Finley_Assemble_PDE(mesh->Nodes,mesh->Elements,_tp->transport_matrix, &_source, &_A, &_B, &_C, &_D, &_X, &_Y );
844       checkFinleyError();
845    
846       Finley_Assemble_PDE(mesh->Nodes,mesh->FaceElements, _tp->transport_matrix, &_source, 0, 0, 0, &_d, 0, &_y );
847       checkFinleyError();
848    
849       Finley_Assemble_PDE(mesh->Nodes,mesh->ContactElements, _tp->transport_matrix, &_source , 0, 0, 0, &_d_contact, 0, &_y_contact );
850       checkFinleyError();
851    }
852    
853  //  //
854  // interpolates data between different function spaces:  // interpolates data between different function spaces:
# Line 846  void MeshAdapter::interpolateOnDomain(es Line 957  void MeshAdapter::interpolateOnDomain(es
957             Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);             Finley_Assemble_AverageElementData(mesh->FaceElements,&_target,&_in);
958          } else {          } else {
959             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on face elements possible.");
960         }          }
961         break;          break;
962       case(ReducedFaceElements):       case(ReducedFaceElements):
963          if (target.getFunctionSpace().getTypeCode()==FaceElements) {          if (target.getFunctionSpace().getTypeCode()==ReducedFaceElements) {
964             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);             Finley_Assemble_CopyElementData(mesh->FaceElements,&_target,&_in);
965          } else {          } else {
966             throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");             throw FinleyAdapterException("Error - No interpolation with data on face elements with reduced integration order possible.");
# Line 870  void MeshAdapter::interpolateOnDomain(es Line 981  void MeshAdapter::interpolateOnDomain(es
981             Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);             Finley_Assemble_AverageElementData(mesh->ContactElements,&_target,&_in);
982          } else {          } else {
983             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");             throw FinleyAdapterException("Error - No interpolation with data on contact elements possible.");
            break;  
984          }          }
985          break;          break;
986       case(ReducedContactElementsZero):       case(ReducedContactElementsZero):
# Line 879  void MeshAdapter::interpolateOnDomain(es Line 989  void MeshAdapter::interpolateOnDomain(es
989             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);             Finley_Assemble_CopyElementData(mesh->ContactElements,&_target,&_in);
990          } else {          } else {
991             throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");             throw FinleyAdapterException("Error - No interpolation with data on contact elements with reduced integration order possible.");
            break;  
992          }          }
993          break;          break;
994       case(DegreesOfFreedom):             case(DegreesOfFreedom):      
# Line 1478  SystemMatrixAdapter MeshAdapter::newSyst Line 1587  SystemMatrixAdapter MeshAdapter::newSyst
1587      Paso_SystemMatrixPattern_free(fsystemMatrixPattern);      Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1588      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);      return SystemMatrixAdapter(fsystemMatrix,row_blocksize,row_functionspace,column_blocksize,column_functionspace);
1589  }  }
1590    // creates a TransportProblemAdapter
1591    TransportProblemAdapter MeshAdapter::newTransportProblem(
1592                          const double theta,
1593                          const int blocksize,
1594                          const escript::FunctionSpace& functionspace,
1595                          const int type) const
1596    {
1597        int reduceOrder=0;
1598        // is the domain right?
1599        const MeshAdapter& domain=dynamic_cast<const MeshAdapter&>(functionspace.getDomain());
1600        if (domain!=*this)
1601              throw FinleyAdapterException("Error - domain of function space does not match the domain of transport problem generator.");
1602        // is the function space type right
1603        if (functionspace.getTypeCode()==DegreesOfFreedom) {
1604            reduceOrder=0;
1605        } else if (functionspace.getTypeCode()==ReducedDegreesOfFreedom) {
1606            reduceOrder=1;
1607        } else {
1608            throw FinleyAdapterException("Error - illegal function space type for system matrix rows.");
1609        }
1610        // generate matrix:
1611        
1612        Paso_SystemMatrixPattern* fsystemMatrixPattern=Finley_getPattern(getFinley_Mesh(),reduceOrder,reduceOrder);
1613        checkFinleyError();
1614        Paso_FCTransportProblem* transportProblem;
1615        transportProblem=Paso_FCTransportProblem_alloc(theta,fsystemMatrixPattern,blocksize);
1616        checkPasoError();
1617        Paso_SystemMatrixPattern_free(fsystemMatrixPattern);
1618        return TransportProblemAdapter(transportProblem,theta,blocksize,functionspace);
1619    }
1620    
1621  //  //
1622  // vtkObject MeshAdapter::createVtkObject() const  // vtkObject MeshAdapter::createVtkObject() const

Legend:
Removed from v.1343  
changed lines
  Added in v.1407

  ViewVC Help
Powered by ViewVC 1.1.26