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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5528 - (hide annotations)
Wed Mar 11 03:48:47 2015 UTC (3 years, 8 months ago) by sshaw
File MIME type: text/plain
File size: 6412 byte(s)
adding single-process multi-resolution ripley domains
1 sshaw 5528
2     /*****************************************************************************
3     *
4     * Copyright (c) 2003-2015 by University of Queensland
5     * http://www.uq.edu.au
6     *
7     * Primary Business: Queensland, Australia
8     * Licensed under the Open Software License version 3.0
9     * http://www.opensource.org/licenses/osl-3.0.php
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     protected:
172     virtual IndexVector getDiagonalIndices(bool upperOnly) const;
173     virtual void interpolateNodesToNodesFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
174     virtual void interpolateNodesToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
175    
176     virtual void interpolateElementsToElementsCoarser(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
177     virtual void interpolateElementsToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
178    
179     virtual void interpolateReducedToElementsFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
180     virtual void interpolateReducedToReducedFiner(const escript::Data& source, escript::Data& target, const MultiBrick& other) const;
181    
182     void populateSampleIds();
183     void populateDofMap();
184     std::vector<IndexVector> getConnections() const;
185    
186     dim_t findNode(const double *coords) const;
187    
188     const unsigned int m_subdivisions;
189     };
190    
191    
192    
193    
194     } // end of namespace ripley
195    
196     #endif // __RIPLEY_MULTIBRICK_H__
197    

  ViewVC Help
Powered by ViewVC 1.1.26