/[escript]/branches/ripleygmg_from_3668/ripley/src/Rectangle.h
ViewVC logotype

Annotation of /branches/ripleygmg_from_3668/ripley/src/Rectangle.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3697 - (hide annotations)
Mon Nov 28 04:52:00 2011 UTC (7 years, 10 months ago) by caltinay
File MIME type: text/plain
File size: 4785 byte(s)
[x] Rectangle node id's and weipa compatibility
[ ] Brick...

1 caltinay 3691
2     /*******************************************************
3     *
4     * Copyright (c) 2003-2011 by University of Queensland
5     * Earth Systems Science Computational Center (ESSCC)
6     * http://www.uq.edu.au/esscc
7     *
8     * Primary Business: Queensland, Australia
9     * Licensed under the Open Software License version 3.0
10     * http://www.opensource.org/licenses/osl-3.0.php
11     *
12     *******************************************************/
13    
14     #ifndef __RIPLEY_RECTANGLE_H__
15     #define __RIPLEY_RECTANGLE_H__
16    
17     #include <ripley/RipleyDomain.h>
18    
19     namespace ripley {
20    
21     /**
22     \brief
23     Rectangle is the 2-dimensional implementation of a RipleyDomain.
24     */
25     class Rectangle: public RipleyDomain
26     {
27     public:
28    
29     /**
30     \brief creates a rectangular mesh with n0 x n1 elements over the
31     rectangle [0,l0] x [0,l1].
32     \param n0,n1 number of elements in each dimension
33     \param l0,l1 length of each side of rectangle
34     \param d0,d1 number of subdivisions in each dimension
35     */
36     RIPLEY_DLL_API
37     Rectangle(int n0, int n1, double l0, double l1, int d0, int d1);
38    
39     /**
40     \brief
41     Destructor.
42     */
43     RIPLEY_DLL_API
44     ~Rectangle();
45    
46     /**
47     \brief
48     returns a description for this domain
49     */
50     RIPLEY_DLL_API
51     virtual std::string getDescription() const;
52    
53     /**
54     \brief equality operator
55     */
56     RIPLEY_DLL_API
57     virtual bool operator==(const escript::AbstractDomain& other) const;
58    
59     /**
60     \brief
61     dumps the mesh to a file with the given name
62     \param filename The name of the output file
63     */
64     RIPLEY_DLL_API
65     void dump(const std::string& filename) const;
66    
67     /**
68     \brief
69     returns the array of reference numbers for a function space type
70     \param fsType The function space type
71     */
72     RIPLEY_DLL_API
73     const int* borrowSampleReferenceIDs(int fsType) const;
74    
75     /**
76     \brief
77     returns true if this rank owns the sample id.
78     */
79     RIPLEY_DLL_API
80     virtual bool ownSample(int fs_code, index_t id) const;
81    
82     /**
83     \brief
84     returns the number of data points summed across all MPI processes
85     */
86     RIPLEY_DLL_API
87     virtual int getNumDataPointsGlobal() const { return (m_gNE0+1)*(m_gNE1+1); }
88    
89     /**
90     \brief
91     interpolates data given on source onto target where source and target
92     have to be given on the same domain
93     */
94     RIPLEY_DLL_API
95     virtual void interpolateOnDomain(escript::Data& target, const escript::Data& source) const;
96    
97     /**
98     \brief
99     writes information about the mesh to standard output
100     \param full whether to print additional data
101     */
102     RIPLEY_DLL_API
103     virtual void Print_Mesh_Info(const bool full=false) const;
104    
105 caltinay 3697 /**
106     \brief
107     returns the number of nodes per MPI rank in each dimension
108     */
109     RIPLEY_DLL_API
110     virtual IndexVector getNumNodesPerDim() const;
111    
112     /**
113     \brief
114     returns the number of elements per MPI rank in each dimension
115     */
116     RIPLEY_DLL_API
117     virtual IndexVector getNumElementsPerDim() const;
118    
119     /**
120     \brief
121     returns the number of face elements in the order
122     (left,right,bottom,top,[front,back]) on current MPI rank
123     */
124     RIPLEY_DLL_API
125     virtual IndexVector getNumFacesPerBoundary() const;
126    
127     /**
128     \brief
129     returns the node distribution vector
130     */
131     RIPLEY_DLL_API
132     virtual IndexVector getNodeDistribution() const { return m_nodeDistribution; }
133    
134     /**
135     \brief
136     returns the first coordinate value and the node spacing along given
137     dimension as a pair
138     */
139     RIPLEY_DLL_API
140     virtual std::pair<double,double> getFirstCoordAndSpacing(dim_t dim) const;
141    
142 caltinay 3691 protected:
143     virtual dim_t getNumNodes() const { return m_N0*m_N1; }
144     virtual dim_t getNumElements() const { return m_NE0*m_NE1; }
145     virtual dim_t getNumFaceElements() const;
146     virtual void assembleCoordinates(escript::Data& arg) const;
147     virtual Paso_SystemMatrixPattern* getPattern(bool reducedRowOrder, bool reducedColOrder) const;
148    
149     private:
150     void populateSampleIds();
151    
152     /// total number of elements in each dimension
153     dim_t m_gNE0, m_gNE1;
154    
155     /// side lengths of domain
156     double m_l0, m_l1;
157    
158     /// number of spatial subdivisions
159     int m_NX, m_NY;
160    
161     /// number of elements for this rank in each dimension
162     dim_t m_NE0, m_NE1;
163    
164     /// number of nodes for this rank in each dimension
165     dim_t m_N0, m_N1;
166    
167     /// first node on this rank is at (offset0,offset1) in global mesh
168     dim_t m_offset0, m_offset1;
169    
170     /// vector of sample reference identifiers
171     IndexVector m_nodeId;
172     IndexVector m_elementId;
173     IndexVector m_faceId;
174 caltinay 3697
175     // vector with first node id on each rank
176     IndexVector m_nodeDistribution;
177 caltinay 3691 };
178    
179     } // end of namespace ripley
180    
181     #endif // __RIPLEY_RECTANGLE_H__
182    

  ViewVC Help
Powered by ViewVC 1.1.26