/[escript]/branches/trilinos_from_5897/dudley/src/Assemble_NodeCoordinates.cpp
ViewVC logotype

Diff of /branches/trilinos_from_5897/dudley/src/Assemble_NodeCoordinates.cpp

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

revision 6078 by caltinay, Wed Mar 2 04:13:26 2016 UTC revision 6079 by caltinay, Mon Mar 21 12:22:38 2016 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
 /****************************************************************************  
   
   assemblage routines: copies node coordinates into an expanded Data Object.  
   
 *****************************************************************************/  
   
17  #include "Assemble.h"  #include "Assemble.h"
18  #include "Util.h"  #include "Util.h"
19    
# Line 27  Line 21 
21    
22  namespace dudley {  namespace dudley {
23    
24  void Assemble_NodeCoordinates(Dudley_NodeFile* nodes, escript::Data* x)  void Assemble_NodeCoordinates(const NodeFile* nodes, escript::Data& x)
25  {  {
26      if (nodes == NULL)      if (nodes == NULL)
27          return;          return;
28    
29      const escript::DataTypes::ShapeType expectedShape(1, nodes->numDim);      const escript::DataTypes::ShapeType expectedShape(1, nodes->numDim);
30    
31      if (!x->numSamplesEqual(1, nodes->numNodes)) {      if (!x.numSamplesEqual(1, nodes->getNumNodes())) {
32          throw DudleyException("Assemble_NodeCoordinates: illegal number of samples of Data object");          throw DudleyException("Assemble_NodeCoordinates: illegal number of samples of Data object");
33      } else if (x->getFunctionSpace().getTypeCode() != DUDLEY_NODES) {      } else if (x.getFunctionSpace().getTypeCode() != DUDLEY_NODES) {
34          throw DudleyException("Assemble_NodeCoordinates: Data object is not defined on nodes.");          throw DudleyException("Assemble_NodeCoordinates: Data object is not defined on nodes.");
35      } else if (!x->actsExpanded()) {      } else if (!x.actsExpanded()) {
36          throw DudleyException("Assemble_NodeCoordinates: expanded Data object expected");          throw DudleyException("Assemble_NodeCoordinates: expanded Data object expected");
37      } else if (x->getDataPointShape() != expectedShape) {      } else if (x.getDataPointShape() != expectedShape) {
38          std::stringstream ss;          std::stringstream ss;
39          ss << "Assemble_NodeCoordinates: Data object of shape ("          ss << "Assemble_NodeCoordinates: Data object of shape ("
40              << nodes->numDim << ",) expected.";              << nodes->numDim << ",) expected.";
# Line 48  void Assemble_NodeCoordinates(Dudley_Nod Line 42  void Assemble_NodeCoordinates(Dudley_Nod
42          throw DudleyException(errorMsg);          throw DudleyException(errorMsg);
43      } else {      } else {
44          const size_t dim_size = nodes->numDim * sizeof(double);          const size_t dim_size = nodes->numDim * sizeof(double);
45          x->requireWrite();          x.requireWrite();
46  #pragma omp parallel for  #pragma omp parallel for
47          for (dim_t n = 0; n < nodes->numNodes; n++)          for (dim_t n = 0; n < nodes->getNumNodes(); n++)
48              memcpy(x->getSampleDataRW(n),              memcpy(x.getSampleDataRW(n),
49                      &nodes->Coordinates[INDEX2(0, n, nodes->numDim)], dim_size);                      &nodes->Coordinates[INDEX2(0, n, nodes->numDim)], dim_size);
50      }      }
51  }  }

Legend:
Removed from v.6078  
changed lines
  Added in v.6079

  ViewVC Help
Powered by ViewVC 1.1.26