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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6112 - (show annotations)
Thu Mar 31 09:40:10 2016 UTC (2 years, 7 months ago) by jfenwick
File MIME type: text/plain
File size: 6604 byte(s)
Relicense all the things!


1
2 /*****************************************************************************
3 *
4 * Copyright (c) 2003-2016 by The University of Queensland
5 * http://www.uq.edu.au
6 *
7 * Primary Business: Queensland, Australia
8 * Licensed under the Apache License, version 2.0
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Development until 2012 by Earth Systems Science Computational Center (ESSCC)
12 * Development 2012-2013 by School of Earth Sciences
13 * Development from 2014 by Centre for Geoscience Computing (GeoComp)
14 *
15 *****************************************************************************/
16
17 #ifndef __RIPLEY_MULTIBRICK_H__
18 #define __RIPLEY_MULTIBRICK_H__
19
20 #include <ripley/Brick.h>
21
22 namespace ripley {
23
24 /**
25 \brief
26 Brick is the 3-dimensional implementation of a RipleyDomain.
27 */
28 class RIPLEY_DLL_API MultiBrick: public Brick
29 {
30 friend class DefaultAssembler3D;
31 friend class WaveAssembler3D;
32 friend class LameAssembler3D;
33 public:
34
35 /**
36 \brief creates a hexagonal mesh with n0 x n1 x n2 elements over the
37 brick [x0,x1] x [y0,y1] x [z0,z1].
38 \param n0,n1,n2 number of elements in each dimension
39 \param x0,y0,z0,x1,y1,z1 coordinates of corner nodes of the brick
40 \param d0,d1,d2 number of subdivisions in each dimension
41 */
42 MultiBrick(dim_t n0, dim_t n1, dim_t n2, double x0, double y0, double z0,
43 double x1, double y1, double z1, int d0=-1, int d1=-1, int d2=-1,
44 const std::vector<double>& points = std::vector<double>(),
45 const std::vector<int>& tags = std::vector<int>(),
46 const TagMap& tagnamestonums = TagMap(),
47 escript::SubWorld_ptr w=escript::SubWorld_ptr(),
48 unsigned int subdivisions = 1
49 );
50
51 /**
52 \brief
53 Destructor.
54 */
55 ~MultiBrick();
56
57 /**
58 \brief
59 interpolates data given on source onto target where source and target
60 are given on different domains
61 */
62 virtual void interpolateAcross(escript::Data& target,
63 const escript::Data& source) const;
64
65 /**
66 \brief
67 Checks that the given interpolation is possible, throw RipleyExceptions
68 if not
69 */
70 void validateInterpolationAcross(int fsType_source,
71 const escript::AbstractDomain& domain, int fsType_target) const;
72
73 /**
74 \brief
75 returns a description for this domain
76 */
77 virtual std::string getDescription() const;
78
79 /**
80 \brief equality operator
81 */
82 virtual bool operator==(const escript::AbstractDomain& other) const;
83
84 /**
85 \brief
86 dumps the mesh to a file with the given name
87 \param filename The name of the output file
88 */
89 void dump(const std::string& filename) const;
90
91 /**
92 */
93 virtual void readNcGrid(escript::Data& out, std::string filename,
94 std::string varname, const ReaderParameters& params) const;
95
96 /**
97 */
98 virtual void readBinaryGrid(escript::Data& out, std::string filename,
99 const ReaderParameters& params) const;
100
101 #ifdef USE_BOOSTIO
102 virtual void readBinaryGridFromZipped(escript::Data& out, std::string filename,
103 const ReaderParameters& params) const;
104 #endif
105
106 /**
107 */
108 virtual void writeBinaryGrid(const escript::Data& in,
109 std::string filename,
110 int byteOrder, int dataType) const;
111 /**
112 \brief
113 returns the array of reference numbers for a function space type
114 \param fsType The function space type
115 */
116 const dim_t* borrowSampleReferenceIDs(int fsType) const;
117
118 /**
119 \brief
120 returns true if this rank owns the sample id.
121 */
122 virtual bool ownSample(int fsType, index_t id) const;
123
124 /**
125 \brief
126 copies the surface normals at data points into out. The actual function
127 space to be considered is defined by out. out has to be defined on this
128 domain.
129 */
130 virtual void setToNormal(escript::Data& out) const;
131
132 /**
133 \brief
134 copies the size of samples into out. The actual function space to be
135 considered is defined by out. out has to be defined on this domain.
136 */
137 virtual void setToSize(escript::Data& out) const;
138
139 /**
140 \brief
141 writes information about the mesh to standard output
142 \param full whether to print additional data
143 */
144 virtual void Print_Mesh_Info(const bool full=false) const;
145
146 /**
147 \brief
148 returns the number of times each root element has been subdivided
149 */
150 virtual unsigned int getNumSubdivisionsPerElement() const { return m_subdivisions; }
151
152 /**
153 \brief
154 returns the number of face elements in the order
155 (left,right,bottom,top,front,back) on current MPI rank
156 */
157 virtual const dim_t* getNumFacesPerBoundary() const { return m_faceCount; }
158
159 /**
160 \brief
161 returns the node distribution vector
162 */
163 virtual IndexVector getNodeDistribution() const { return m_nodeDistribution; }
164
165 /**
166 \brief
167 returns the number of spatial subdivisions in each dimension
168 */
169 virtual const int* getNumSubdivisionsPerDim() const { return m_NX; }
170
171 /**
172 \brief
173 returns a vector of rank numbers where vec[i]=n means that rank n
174 'owns' element/face element i.
175 */
176 virtual RankVector getOwnerVector(int fsType) const;
177
178 protected:
179 virtual IndexVector getDiagonalIndices(bool upperOnly) const;
180 virtual void interpolateNodesToNodesFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
181 virtual void interpolateNodesToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
182
183 virtual void interpolateElementsToElementsCoarser(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
184 virtual void interpolateElementsToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
185
186 virtual void interpolateReducedToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
187 virtual void interpolateReducedToReducedFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
188
189 void populateSampleIds();
190 void populateDofMap();
191 std::vector<IndexVector> getConnections() const;
192
193 dim_t findNode(const double *coords) const;
194
195 const unsigned int m_subdivisions;
196 };
197
198
199
200
201 } // end of namespace ripley
202
203 #endif // __RIPLEY_MULTIBRICK_H__
204

  ViewVC Help
Powered by ViewVC 1.1.26