/[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 6008 by caltinay, Mon Feb 22 06:59:27 2016 UTC revision 6009 by caltinay, Wed Mar 2 04:13:26 2016 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
17  /************************************************************************************/  /****************************************************************************
18    
19  /*    assemblage routines: copies node coordinates into an expanded Data Object */    assemblage routines: copies node coordinates into an expanded Data Object.
20    
21  /************************************************************************************/  *****************************************************************************/
   
 #define ESNEEDPYTHON  
 #include "esysUtils/first.h"  
22    
23  #include "Assemble.h"  #include "Assemble.h"
24  #include "Util.h"  #include "Util.h"
25    
26  #include <sstream>  #include <sstream>
27    
28  void Dudley_Assemble_NodeCoordinates(Dudley_NodeFile* nodes, escript::Data* x)  namespace dudley {
29    
30    void Assemble_NodeCoordinates(Dudley_NodeFile* nodes, escript::Data* x)
31  {  {
     Dudley_resetError();  
32      if (nodes == NULL)      if (nodes == NULL)
33          return;          return;
34      if (!numSamplesEqual(x, 1, nodes->numNodes))  
35      {      const escript::DataTypes::ShapeType expectedShape(1, nodes->numDim);
36          Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: illegal number of samples of Data object");  
37      }      if (!x->numSamplesEqual(1, nodes->numNodes)) {
38      else if (getFunctionSpaceType(x) != DUDLEY_NODES)          throw DudleyException("Assemble_NodeCoordinates: illegal number of samples of Data object");
39      {      } else if (x->getFunctionSpace().getTypeCode() != DUDLEY_NODES) {
40          Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: Data object is not defined on nodes.");          throw DudleyException("Assemble_NodeCoordinates: Data object is not defined on nodes.");
41      }      } else if (!x->actsExpanded()) {
42      else if (!isExpanded(x))          throw DudleyException("Assemble_NodeCoordinates: expanded Data object expected");
43      {      } else if (x->getDataPointShape() != expectedShape) {
         Dudley_setError(TYPE_ERROR, "Dudley_Assemble_NodeCoordinates: expanded Data object expected");  
     }  
     else if (!isDataPointShapeEqual(x, 1, &(nodes->numDim)))  
     {  
44          std::stringstream ss;          std::stringstream ss;
45          ss << "Dudley_Assemble_NodeCoordinates: Data object of shape ("          ss << "Assemble_NodeCoordinates: Data object of shape ("
46              << nodes->numDim << ",) expected.";              << nodes->numDim << ",) expected.";
47          std::string errorMsg(ss.str());          const std::string errorMsg(ss.str());
48          Dudley_setError(TYPE_ERROR, errorMsg.c_str());          throw DudleyException(errorMsg);
49      }      } else {
     else  
     {  
50          const size_t dim_size = nodes->numDim * sizeof(double);          const size_t dim_size = nodes->numDim * sizeof(double);
51          x->requireWrite();          x->requireWrite();
52  #pragma omp parallel for  #pragma omp parallel for
# Line 63  void Dudley_Assemble_NodeCoordinates(Dud Line 55  void Dudley_Assemble_NodeCoordinates(Dud
55                      &nodes->Coordinates[INDEX2(0, n, nodes->numDim)], dim_size);                      &nodes->Coordinates[INDEX2(0, n, nodes->numDim)], dim_size);
56      }      }
57  }  }
58    
59    } // namespace dudley
60    

Legend:
Removed from v.6008  
changed lines
  Added in v.6009

  ViewVC Help
Powered by ViewVC 1.1.26