/[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 5962 by caltinay, Fri Feb 5 03:37:49 2016 UTC revision 5963 by caltinay, Mon Feb 22 06:59:27 2016 UTC
# Line 23  Line 23 
23  #define ESNEEDPYTHON  #define ESNEEDPYTHON
24  #include "esysUtils/first.h"  #include "esysUtils/first.h"
25    
 #include "Util.h"  
26  #include "Assemble.h"  #include "Assemble.h"
27  #ifdef _OPENMP  #include "Util.h"
 #include <omp.h>  
 #endif  
28    
29  /************************************************************************************/  #include <sstream>
30    
31  void Dudley_Assemble_NodeCoordinates(Dudley_NodeFile * nodes, escript::Data * x)  void Dudley_Assemble_NodeCoordinates(Dudley_NodeFile* nodes, escript::Data* x)
32  {  {
     char error_msg[LenErrorMsg_MAX];  
     dim_t n;  
     size_t dim_size;  
33      Dudley_resetError();      Dudley_resetError();
34      if (nodes == NULL)      if (nodes == NULL)
35      return;          return;
36      if (!numSamplesEqual(x, 1, nodes->numNodes))      if (!numSamplesEqual(x, 1, nodes->numNodes))
37      {      {
38      Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: illegal number of samples of Data object");          Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: illegal number of samples of Data object");
39      }      }
40      else if (getFunctionSpaceType(x) != DUDLEY_NODES)      else if (getFunctionSpaceType(x) != DUDLEY_NODES)
41      {      {
42      Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: Data object is not defined on nodes.");          Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: Data object is not defined on nodes.");
43      }      }
44      else if (!isExpanded(x))      else if (!isExpanded(x))
45      {      {
46      Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: expanded Data object expected");          Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: expanded Data object expected");
47      }      }
48      else if (!isDataPointShapeEqual(x, 1, &(nodes->numDim)))      else if (!isDataPointShapeEqual(x, 1, &(nodes->numDim)))
49      {      {
50      sprintf(error_msg, "Dudley_Assemble_NodeCoordinates: Data object of shape (%d,) expected", nodes->numDim);          std::stringstream ss;
51      Dudley_setError(TYPE_ERROR, error_msg);          ss << "Dudley_Assemble_NodeCoordinates: Data object of shape ("
52                << nodes->numDim << ",) expected.";
53            std::string errorMsg(ss.str());
54            Dudley_setError(TYPE_ERROR, errorMsg.c_str());
55      }      }
56      else      else
57      {      {
58      dim_size = nodes->numDim * sizeof(double);          const size_t dim_size = nodes->numDim * sizeof(double);
59      requireWrite(x);          x->requireWrite();
60  #pragma omp parallel for private(n)  #pragma omp parallel for
61      for (n = 0; n < nodes->numNodes; n++)          for (dim_t n = 0; n < nodes->numNodes; n++)
62          memcpy(getSampleDataRWFast(x, n), &(nodes->Coordinates[INDEX2(0, n, nodes->numDim)]), dim_size);              memcpy(x->getSampleDataRW(n),
63                        &nodes->Coordinates[INDEX2(0, n, nodes->numDim)], dim_size);
64      }      }
65  }  }

Legend:
Removed from v.5962  
changed lines
  Added in v.5963

  ViewVC Help
Powered by ViewVC 1.1.26