/[escript]/branches/diaplayground/ripley/src/Brick.cpp
ViewVC logotype

Diff of /branches/diaplayground/ripley/src/Brick.cpp

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

revision 4851 by sshaw, Wed Apr 9 03:30:36 2014 UTC revision 4934 by jfenwick, Tue May 13 00:28:11 2014 UTC
# Line 14  Line 14 
14  *  *
15  *****************************************************************************/  *****************************************************************************/
16    
17    #include <limits>
18    
19  #include <ripley/Brick.h>  #include <ripley/Brick.h>
20  #include <paso/SystemMatrix.h>  #include <paso/SystemMatrix.h>
21  #include <esysUtils/esysFileWriter.h>  #include <esysUtils/esysFileWriter.h>
# Line 60  int indexOfMax(int a, int b, int c) { Line 62  int indexOfMax(int a, int b, int c) {
62  Brick::Brick(int n0, int n1, int n2, double x0, double y0, double z0,  Brick::Brick(int n0, int n1, int n2, double x0, double y0, double z0,
63               double x1, double y1, double z1, int d0, int d1, int d2,               double x1, double y1, double z1, int d0, int d1, int d2,
64               const std::vector<double>& points, const std::vector<int>& tags,               const std::vector<double>& points, const std::vector<int>& tags,
65               const simap_t& tagnamestonums) :               const simap_t& tagnamestonums,
66      RipleyDomain(3)               escript::SubWorld_ptr w) :
67  {      RipleyDomain(3, w)
68    {
69        if (static_cast<long>(n0 + 1) * static_cast<long>(n1 + 1)
70                * static_cast<long>(n2 + 1) > std::numeric_limits<int>::max())
71            throw RipleyException("The number of elements has overflowed, this "
72                    "limit may be raised in future releases.");
73    
74      if (n0 <= 0 || n1 <= 0 || n2 <= 0)      if (n0 <= 0 || n1 <= 0 || n2 <= 0)
75          throw RipleyException("Number of elements in each spatial dimension "          throw RipleyException("Number of elements in each spatial dimension "
76                  "must be positive");                  "must be positive");
# Line 2055  void Brick::dofToNodes(escript::Data& ou Line 2063  void Brick::dofToNodes(escript::Data& ou
2063      paso::Coupler_ptr coupler(new paso::Coupler(m_connector, numComp));      paso::Coupler_ptr coupler(new paso::Coupler(m_connector, numComp));
2064      // expand data object if necessary to be able to grab the whole data      // expand data object if necessary to be able to grab the whole data
2065      const_cast<escript::Data*>(&in)->expand();      const_cast<escript::Data*>(&in)->expand();
2066      coupler->startCollect(in.getSampleDataRO(0));      coupler->startCollect(in.getDataRO());
2067    
2068      const dim_t numDOF = getNumDOF();      const dim_t numDOF = getNumDOF();
2069      out.requireWrite();      out.requireWrite();
# Line 2088  void Brick::populateSampleIds() Line 2096  void Brick::populateSampleIds()
2096          m_nodeDistribution[k]=k*numDOF;          m_nodeDistribution[k]=k*numDOF;
2097      }      }
2098      m_nodeDistribution[m_mpiInfo->size]=getNumDataPointsGlobal();      m_nodeDistribution[m_mpiInfo->size]=getNumDataPointsGlobal();
2099      m_nodeId.resize(getNumNodes());      
2100      m_dofId.resize(numDOF);      try {
2101      m_elementId.resize(getNumElements());          m_nodeId.resize(getNumNodes());
2102            m_dofId.resize(numDOF);
2103            m_elementId.resize(getNumElements());
2104        } catch (const std::length_error& le) {
2105            throw RipleyException("The system does not have sufficient memory for a domain of this size.");
2106        }
2107        
2108      // populate face element counts      // populate face element counts
2109      //left      //left
2110      if (m_offset[0]==0)      if (m_offset[0]==0)

Legend:
Removed from v.4851  
changed lines
  Added in v.4934

  ViewVC Help
Powered by ViewVC 1.1.26