/[escript]/trunk/ripley/src/Brick.h
ViewVC logotype

Diff of /trunk/ripley/src/Brick.h

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

revision 4277 by caltinay, Wed Mar 6 01:30:41 2013 UTC revision 4334 by caltinay, Thu Mar 21 06:00:14 2013 UTC
# Line 79  public: Line 79  public:
79              const std::vector<int>& multiplier) const;              const std::vector<int>& multiplier) const;
80    
81      /**      /**
82        */
83        virtual void writeBinaryGrid(const escript::Data& in,
84                                     std::string filename, int byteOrder) const;
85    
86        /**
87         \brief         \brief
88         returns the reference number of the given sample number         returns the reference number of the given sample number
89         \param fsType The function space type         \param fsType The function space type
# Line 110  public: Line 115  public:
115         \brief         \brief
116         returns the number of data points summed across all MPI processes         returns the number of data points summed across all MPI processes
117      */      */
118      virtual int getNumDataPointsGlobal() const { return (m_gNE0+1)*(m_gNE1+1)*(m_gNE2+1); }      virtual int getNumDataPointsGlobal() const;
119    
120      /**      /**
121         \brief         \brief
# Line 123  public: Line 128  public:
128         \brief         \brief
129         returns the number of nodes per MPI rank in each dimension         returns the number of nodes per MPI rank in each dimension
130      */      */
131      virtual IndexVector getNumNodesPerDim() const;      virtual const int* getNumNodesPerDim() const { return m_NN; }
132    
133      /**      /**
134         \brief         \brief
135         returns the number of elements per MPI rank in each dimension         returns the number of elements per MPI rank in each dimension
136      */      */
137      virtual IndexVector getNumElementsPerDim() const;      virtual const int* getNumElementsPerDim() const { return m_NE; }
138    
139      /**      /**
140         \brief         \brief
141         returns the number of face elements in the order         returns the number of face elements in the order
142         (left,right,bottom,top,[front,back]) on current MPI rank         (left,right,bottom,top,front,back) on current MPI rank
143      */      */
144      virtual IndexVector getNumFacesPerBoundary() const;      virtual const int* getNumFacesPerBoundary() const { return m_faceCount; }
145    
146      /**      /**
147         \brief         \brief
# Line 148  public: Line 153  public:
153         \brief         \brief
154         returns the number of spatial subdivisions in each dimension         returns the number of spatial subdivisions in each dimension
155      */      */
156      virtual IndexVector getNumSubdivisionsPerDim() const;      virtual const int* getNumSubdivisionsPerDim() const { return m_NX; }
157    
158      /**      /**
159         \brief         \brief
160         returns the first coordinate value and the node spacing along given         returns the index'th coordinate value in given dimension for this rank
        dimension as a pair  
161      */      */
162      virtual std::pair<double,double> getFirstCoordAndSpacing(dim_t dim) const;      virtual double getLocalCoordinate(int index, int dim) const;
163    
164  protected:  protected:
165      virtual dim_t getNumNodes() const { return m_N0*m_N1*m_N2; }      virtual dim_t getNumNodes() const;
166      virtual dim_t getNumElements() const { return m_NE0*m_NE1*m_NE2; }      virtual dim_t getNumElements() const;
167      virtual dim_t getNumFaceElements() const;      virtual dim_t getNumFaceElements() const;
168      virtual dim_t getNumDOF() const;      virtual dim_t getNumDOF() const;
169      virtual dim_t insertNeighbourNodes(IndexVector& index, index_t node) const;      virtual dim_t insertNeighbourNodes(IndexVector& index, index_t node) const;
# Line 211  private: Line 215  private:
215    
216    
217      /// total number of elements in each dimension      /// total number of elements in each dimension
218      dim_t m_gNE0, m_gNE1, m_gNE2;      dim_t m_gNE[3];
219    
220      /// location of domain      /// origin of domain
221      double m_x0, m_y0, m_z0;      double m_origin[3];
222    
223      /// side lengths of domain      /// side lengths of domain
224      double m_l0, m_l1, m_l2;      double m_length[3];
225    
226        /// grid spacings / cell sizes of domain
227        double m_dx[3];
228    
229      /// number of spatial subdivisions      /// number of spatial subdivisions
230      int m_NX, m_NY, m_NZ;      int m_NX[3];
231    
232      /// number of elements for this rank in each dimension including shared      /// number of elements for this rank in each dimension including shared
233      dim_t m_NE0, m_NE1, m_NE2;      dim_t m_NE[3];
234    
235      /// number of own elements for this rank in each dimension      /// number of own elements for this rank in each dimension
236      dim_t m_ownNE0, m_ownNE1, m_ownNE2;      dim_t m_ownNE[3];
237    
238      /// number of nodes for this rank in each dimension      /// number of nodes for this rank in each dimension
239      dim_t m_N0, m_N1, m_N2;      dim_t m_NN[3];
240    
241      /// first node on this rank is at (offset0,offset1,offset2) in global mesh      /// first node on this rank is at (offset0,offset1,offset2) in global mesh
242      dim_t m_offset0, m_offset1, m_offset2;      dim_t m_offset[3];
243    
244        /// number of face elements per edge (left, right, bottom, top, front, back)
245        int m_faceCount[6];
246    
247      /// faceOffset[i]=-1 if face i is not an external face, otherwise it is      /// faceOffset[i]=-1 if face i is not an external face, otherwise it is
248      /// the index of that face (where i: 0=left, 1=right, 2=bottom, 3=top,      /// the index of that face (where i: 0=left, 1=right, 2=bottom, 3=top,
# Line 259  private: Line 269  private:
269      Paso_SystemMatrixPattern* m_pattern;      Paso_SystemMatrixPattern* m_pattern;
270  };  };
271    
272    ////////////////////////////// inline methods ////////////////////////////////
273    
274    inline int Brick::getNumDataPointsGlobal() const
275    {
276        return (m_gNE[0]+1)*(m_gNE[1]+1)*(m_gNE[2]+1);
277    }
278    
279    inline double Brick::getLocalCoordinate(int index, int dim) const
280    {
281        EsysAssert((dim>=0 && dim<=2), "'dim' out of bounds");
282        EsysAssert((index>=0 && index<m_NN[dim]), "'index' out of bounds");
283        return m_origin[dim]+m_dx[dim]*(m_offset[dim]+index);
284    }
285    
286    inline Paso_SystemMatrixPattern* Brick::getPattern(bool reducedRowOrder,
287                                                       bool reducedColOrder) const
288    {
289        // TODO: reduced
290        return m_pattern;
291    }
292    
293    
294    //protected
295    inline dim_t Brick::getNumDOF() const
296    {
297        return (m_gNE[0]+1)/m_NX[0]*(m_gNE[1]+1)/m_NX[1]*(m_gNE[2]+1)/m_NX[2];
298    }
299    
300    //protected
301    inline dim_t Brick::getNumNodes() const
302    {
303        return m_NN[0]*m_NN[1]*m_NN[2];
304    }
305    
306    //protected
307    inline dim_t Brick::getNumElements() const
308    {
309        return m_NE[0]*m_NE[1]*m_NE[2];
310    }
311    
312    //protected
313    inline dim_t Brick::getNumFaceElements() const
314    {
315        return m_faceCount[0] + m_faceCount[1] + m_faceCount[2]
316                + m_faceCount[3] + m_faceCount[4] + m_faceCount[5];
317    }
318    
319  } // end of namespace ripley  } // end of namespace ripley
320    
321  #endif // __RIPLEY_BRICK_H__  #endif // __RIPLEY_BRICK_H__

Legend:
Removed from v.4277  
changed lines
  Added in v.4334

  ViewVC Help
Powered by ViewVC 1.1.26