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

Contents of /trunk/ripley/src/Rectangle.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3691 - (show annotations)
Wed Nov 23 23:07:37 2011 UTC (7 years, 10 months ago) by caltinay
Original Path: branches/ripleygmg_from_3668/ripley/src/Rectangle.h
File MIME type: text/plain
File size: 3733 byte(s)
Next iteration

1
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 protected:
106 virtual dim_t getNumNodes() const { return m_N0*m_N1; }
107 virtual dim_t getNumElements() const { return m_NE0*m_NE1; }
108 virtual dim_t getNumFaceElements() const;
109 virtual void assembleCoordinates(escript::Data& arg) const;
110 virtual Paso_SystemMatrixPattern* getPattern(bool reducedRowOrder, bool reducedColOrder) const;
111
112 private:
113 void populateSampleIds();
114
115 /// total number of elements in each dimension
116 dim_t m_gNE0, m_gNE1;
117
118 /// side lengths of domain
119 double m_l0, m_l1;
120
121 /// number of spatial subdivisions
122 int m_NX, m_NY;
123
124 /// number of elements for this rank in each dimension
125 dim_t m_NE0, m_NE1;
126
127 /// number of nodes for this rank in each dimension
128 dim_t m_N0, m_N1;
129
130 /// first node on this rank is at (offset0,offset1) in global mesh
131 dim_t m_offset0, m_offset1;
132
133 /// vector of sample reference identifiers
134 IndexVector m_nodeId;
135 IndexVector m_elementId;
136 IndexVector m_faceId;
137 };
138
139 } // end of namespace ripley
140
141 #endif // __RIPLEY_RECTANGLE_H__
142

  ViewVC Help
Powered by ViewVC 1.1.26