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

Diff of /branches/trilinos_from_5897/dudley/src/NodeFile_setCoordinates.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 30  Line 30 
30    
31  /************************************************************************************/  /************************************************************************************/
32    
33  void Dudley_NodeFile_setCoordinates(Dudley_NodeFile * self, const escript::Data* newX)  void Dudley_NodeFile_setCoordinates(Dudley_NodeFile* self, const escript::Data* newX)
34  {  {
     char error_msg[LenErrorMsg_MAX];  
     size_t numDim_size;  
     int n;  
35      if (getDataPointSize(newX) != self->numDim)      if (getDataPointSize(newX) != self->numDim)
36      {      {
37      sprintf(error_msg, "Dudley_NodeFile_setCoordinates: dimension of new coordinates has to be %d.", self->numDim);          std::stringstream ss;
38      Dudley_setError(VALUE_ERROR, error_msg);          ss << "Dudley_NodeFile_setCoordinates: number of dimensions of new "
39      }              "coordinates has to be " << self->numDim;
40      else if (!numSamplesEqual(newX, 1, self->numNodes))          const std::string errorMsg(ss.str());
41      {          Dudley_setError(VALUE_ERROR, errorMsg.c_str());
42      sprintf(error_msg, "Dudley_NodeFile_setCoordinates: number of given nodes must to be %d.", self->numNodes);      } else if (!numSamplesEqual(newX, 1, self->numNodes)) {
43      Dudley_setError(VALUE_ERROR, error_msg);          std::stringstream ss;
44      }          ss << "Dudley_NodeFile_setCoordinates: number of given nodes must be "
45      else              << self->numNodes;
46      {          const std::string errorMsg(ss.str());
47      numDim_size = self->numDim * sizeof(double);          Dudley_setError(VALUE_ERROR, errorMsg.c_str());
48      Dudley_increaseStatus(self);      } else {
49  #pragma omp parallel private(n)          const size_t numDim_size = self->numDim * sizeof(double);
50      {          Dudley_increaseStatus(self);
51    #pragma omp parallel for
52  #pragma omp for schedule(static)          for (index_t n = 0; n < self->numNodes; n++) {
53          for (n = 0; n < self->numNodes; n++)              memcpy(&self->Coordinates[INDEX2(0, n, self->numDim)],
54          {                      newX->getSampleDataRO(n), numDim_size);
55          memcpy(&(self->Coordinates[INDEX2(0, n, self->numDim)]), getSampleDataROFast(newX, n), numDim_size);          }
         }  
     }  
56      }      }
57  }  }
58    

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

  ViewVC Help
Powered by ViewVC 1.1.26