/[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 1346 by ksteube, Wed Nov 14 22:48:12 2007 UTC
# Line 158  void MeshAdapter::dump(const std::string Line 158  void MeshAdapter::dump(const std::string
158        if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )        if (! (ncdims[9] = dataFile.add_dim("dim_ContactElements_numNodes", num_ContactElements_numNodes)) )
159          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);
160    
161     // MPI size, MPI rank, Name, order, reduced_order     // Attributes: MPI size, MPI rank, Name, order, reduced_order
162     if (!dataFile.add_att("mpi_size", mpi_size) )     if (!dataFile.add_att("mpi_size", mpi_size) )
163          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);
164     if (!dataFile.add_att("mpi_rank", mpi_rank) )     if (!dataFile.add_att("mpi_rank", mpi_rank) )
165          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);
166     if (!dataFile.add_att("Name",mesh->Name) )     if (!dataFile.add_att("Name",mesh->Name) )
167          throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending Name to NetCDF file failed: " + *newFileName);
168       if (!dataFile.add_att("numDim",numDim) )
169            throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
170     if (!dataFile.add_att("order",mesh->order) )     if (!dataFile.add_att("order",mesh->order) )
171          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);          throw DataException("Error - MeshAdapter::dump: appending order to NetCDF file failed: " + *newFileName);
172     if (!dataFile.add_att("reduced_order",mesh->reduced_order) )     if (!dataFile.add_att("reduced_order",mesh->reduced_order) )
173          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);
174       if (!dataFile.add_att("numNodes",numNodes) )
175            throw DataException("Error - MeshAdapter::dump: appending numNodes to NetCDF file failed: " + *newFileName);
176     if (!dataFile.add_att("num_Elements",num_Elements) )     if (!dataFile.add_att("num_Elements",num_Elements) )
177          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);
178     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 181  void MeshAdapter::dump(const std::string
181          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);
182     if (!dataFile.add_att("num_Points",num_Points) )     if (!dataFile.add_att("num_Points",num_Points) )
183          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);
184       if (!dataFile.add_att("num_Elements_numNodes",num_Elements_numNodes) )
185            throw DataException("Error - MeshAdapter::dump: appending num_Elements_numNodes to NetCDF file failed: " + *newFileName);
186       if (!dataFile.add_att("num_FaceElements_numNodes",num_FaceElements_numNodes) )
187            throw DataException("Error - MeshAdapter::dump: appending num_FaceElements_numNodes to NetCDF file failed: " + *newFileName);
188       if (!dataFile.add_att("num_ContactElements_numNodes",num_ContactElements_numNodes) )
189            throw DataException("Error - MeshAdapter::dump: appending num_ContactElements_numNodes to NetCDF file failed: " + *newFileName);
190    
191     // // // // // Nodes // // // // //     // // // // // Nodes // // // // //
192    
193       // Only write nodes if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)
194       if (numNodes>0) {
195    
196     // Nodes Id     // Nodes Id
197     if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )     if (! ( ids = dataFile.add_var("Nodes_Id", ncInt, ncdims[0])) )
198          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 248  void MeshAdapter::dump(const std::string
248     if (! (ids->put(int_ptr, mpi_size+1)) )     if (! (ids->put(int_ptr, mpi_size+1)) )
249          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);
250    
251       }
252    
253     // // // // // Elements // // // // //     // // // // // Elements // // // // //
254    
    // Only write elements if non-empty because NetCDF doesn't like empty arrays (it treats them as NC_UNLIMITED)  
255     if (num_Elements>0) {     if (num_Elements>0) {
256    
257       // Temp storage to gather node IDs       // Temp storage to gather node IDs
# Line 284  void MeshAdapter::dump(const std::string Line 298  void MeshAdapter::dump(const std::string
298       if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )       if (! (ids->put(&(Elements_Nodes[0]), num_Elements, num_Elements_numNodes)) )
299          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);
300    
301         TMPMEMFREE(Elements_Nodes);
302    
303     }     }
304    
305     // // // // // Face_Elements // // // // //     // // // // // Face_Elements // // // // //
# Line 334  void MeshAdapter::dump(const std::string Line 350  void MeshAdapter::dump(const std::string
350       if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )       if (! (ids->put(&(FaceElements_Nodes[0]), num_FaceElements, num_FaceElements_numNodes)) )
351          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);
352    
353         TMPMEMFREE(FaceElements_Nodes);
354    
355     }     }
356    
357     // // // // // Contact_Elements // // // // //     // // // // // Contact_Elements // // // // //
# Line 384  void MeshAdapter::dump(const std::string Line 402  void MeshAdapter::dump(const std::string
402       if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )       if (! (ids->put(&(ContactElements_Nodes[0]), num_ContactElements, num_ContactElements_numNodes)) )
403          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);
404    
405         TMPMEMFREE(ContactElements_Nodes);
406    
407     }     }
408    
409     // // // // // Points // // // // //     // // // // // Points // // // // //
# Line 436  void MeshAdapter::dump(const std::string Line 456  void MeshAdapter::dump(const std::string
456       if (! (ids->put(&(Points_Nodes[0]), num_Points)) )       if (! (ids->put(&(Points_Nodes[0]), num_Points)) )
457          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);
458    
459         TMPMEMFREE(Points_Nodes);
460    
461     }     }
462    
463     // // // // // TagMap // // // // //     // // // // // TagMap // // // // //

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

  ViewVC Help
Powered by ViewVC 1.1.26