/[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 2778 by caltinay, Thu Nov 26 01:50:30 2009 UTC revision 2940 by caltinay, Fri Feb 19 00:38:45 2010 UTC
# Line 1  Line 1 
1    
2  /*******************************************************  /*******************************************************
3  *  *
4  * Copyright (c) 2003-2009 by University of Queensland  * Copyright (c) 2003-2010 by University of Queensland
5  * Earth Systems Science Computational Center (ESSCC)  * Earth Systems Science Computational Center (ESSCC)
6  * http://www.uq.edu.au/esscc  * http://www.uq.edu.au/esscc
7  *  *
# Line 220  void MeshAdapter::dump(const string& fil Line 220  void MeshAdapter::dump(const string& fil
220        throw DataException(msgPrefix+"add_att(Name)");        throw DataException(msgPrefix+"add_att(Name)");
221     if (!dataFile.add_att("numDim",numDim) )     if (!dataFile.add_att("numDim",numDim) )
222        throw DataException(msgPrefix+"add_att(order)");        throw DataException(msgPrefix+"add_att(order)");
223     if (!dataFile.add_att("order",mesh->order) )     if (!dataFile.add_att("order",mesh->integrationOrder) )
224        throw DataException(msgPrefix+"add_att(order)");        throw DataException(msgPrefix+"add_att(order)");
225     if (!dataFile.add_att("reduced_order",mesh->reduced_order) )     if (!dataFile.add_att("reduced_order",mesh->reducedIntegrationOrder) )
226        throw DataException(msgPrefix+"add_att(reduced_order)");        throw DataException(msgPrefix+"add_att(reduced_order)");
227     if (!dataFile.add_att("numNodes",numNodes) )     if (!dataFile.add_att("numNodes",numNodes) )
228        throw DataException(msgPrefix+"add_att(numNodes)");        throw DataException(msgPrefix+"add_att(numNodes)");
# Line 253  void MeshAdapter::dump(const string& fil Line 253  void MeshAdapter::dump(const string& fil
253    
254     // // // // // Nodes // // // // //     // // // // // Nodes // // // // //
255    
256       // Nodes nodeDistribution
257       if (! ( ids = dataFile.add_var("Nodes_NodeDistribution", ncInt, ncdims[2])) )
258          throw DataException(msgPrefix+"add_var(Nodes_NodeDistribution)");
259       int_ptr = &mesh->Nodes->nodesDistribution->first_component[0];
260       if (! (ids->put(int_ptr, mpi_size+1)) )
261          throw DataException(msgPrefix+"put(Nodes_NodeDistribution)");
262    
263       // Nodes degreesOfFreedomDistribution
264       if (! ( ids = dataFile.add_var("Nodes_DofDistribution", ncInt, ncdims[2])) )
265          throw DataException(msgPrefix+"add_var(Nodes_DofDistribution)");
266       int_ptr = &mesh->Nodes->degreesOfFreedomDistribution->first_component[0];
267       if (! (ids->put(int_ptr, mpi_size+1)) )
268          throw DataException(msgPrefix+"put(Nodes_DofDistribution)");
269    
270     // Only write nodes if non-empty because NetCDF doesn't like empty arrays     // Only write nodes if non-empty because NetCDF doesn't like empty arrays
271     // (it treats them as NC_UNLIMITED)     // (it treats them as NC_UNLIMITED)
272     if (numNodes>0) {     if (numNodes>0) {
# Line 305  void MeshAdapter::dump(const string& fil Line 319  void MeshAdapter::dump(const string& fil
319        if (! (ids->put(&(mesh->Nodes->Coordinates[INDEX2(0,0,numDim)]), numNodes, numDim)) )        if (! (ids->put(&(mesh->Nodes->Coordinates[INDEX2(0,0,numDim)]), numNodes, numDim)) )
320           throw DataException(msgPrefix+"put(Nodes_Coordinates)");           throw DataException(msgPrefix+"put(Nodes_Coordinates)");
321    
       // Nodes degreesOfFreedomDistribution  
       if (! ( ids = dataFile.add_var("Nodes_DofDistribution", ncInt, ncdims[2])) )  
          throw DataException(msgPrefix+"add_var(Nodes_DofDistribution)");  
       int_ptr = &mesh->Nodes->degreesOfFreedomDistribution->first_component[0];  
       if (! (ids->put(int_ptr, mpi_size+1)) )  
          throw DataException(msgPrefix+"put(Nodes_DofDistribution)");  
   
       // Nodes nodeDistribution  
       if (! ( ids = dataFile.add_var("Nodes_NodeDistribution", ncInt, ncdims[2])) )  
          throw DataException(msgPrefix+"add_var(Nodes_NodeDistribution)");  
       int_ptr = &mesh->Nodes->nodesDistribution->first_component[0];  
       if (! (ids->put(int_ptr, mpi_size+1)) )  
          throw DataException(msgPrefix+"put(Nodes_NodeDistribution)");  
   
322     }     }
323    
324     // // // // // Elements // // // // //     // // // // // Elements // // // // //
# Line 1727  MeshAdapter::commonFunctionSpace(const v Line 1727  MeshAdapter::commonFunctionSpace(const v
1727     For classes with multiple members (eg class 2) we have vars to record if there is at least one instance.     For classes with multiple members (eg class 2) we have vars to record if there is at least one instance.
1728     eg hasnodes is true if we have at least one instance of Nodes.     eg hasnodes is true if we have at least one instance of Nodes.
1729     */     */
1730      if (fs.size()==0)      if (fs.empty())
1731      {      {
1732          return false;          return false;
1733      }      }
# Line 2360  AbstractDomain::StatusType MeshAdapter:: Line 2360  AbstractDomain::StatusType MeshAdapter::
2360    return Finley_Mesh_getStatus(mesh);    return Finley_Mesh_getStatus(mesh);
2361  }  }
2362    
2363    int MeshAdapter::getApproximationOrder(const int functionSpaceCode) const
2364    {
2365      
2366      Finley_Mesh* mesh=m_finleyMesh.get();
2367      int order =-1;
2368      switch(functionSpaceCode) {
2369       case(Nodes):
2370       case(DegreesOfFreedom):
2371              order=mesh->approximationOrder;
2372              break;
2373       case(ReducedNodes):
2374       case(ReducedDegreesOfFreedom):
2375              order=mesh->reducedApproximationOrder;
2376              break;
2377       case(Elements):
2378       case(FaceElements):
2379       case(Points):
2380       case(ContactElementsZero):
2381       case(ContactElementsOne):
2382              order=mesh->integrationOrder;
2383              break;
2384       case(ReducedElements):
2385       case(ReducedFaceElements):
2386       case(ReducedContactElementsZero):
2387       case(ReducedContactElementsOne):
2388              order=mesh->reducedIntegrationOrder;
2389              break;
2390       default:
2391          stringstream temp;
2392          temp << "Error - Finley does not know anything about function space type " << functionSpaceCode;
2393          throw FinleyAdapterException(temp.str());
2394      }
2395      return order;
2396    }
2397    
2398    ReferenceElementSetWrapper::ReferenceElementSetWrapper(ElementTypeId id, index_t order, index_t reducedOrder)
2399    {
2400      m_refSet = Finley_ReferenceElementSet_alloc(id, order, reducedOrder);
2401    }
2402    
2403    ReferenceElementSetWrapper::~ReferenceElementSetWrapper()
2404    {
2405      Finley_ReferenceElementSet_dealloc(m_refSet);
2406    }
2407    
2408  }  // end of namespace  }  // end of namespace

Legend:
Removed from v.2778  
changed lines
  Added in v.2940

  ViewVC Help
Powered by ViewVC 1.1.26