OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Interpolator3dGridTo3d.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2012, Chris Rogers
3 * All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 * 1. Redistributions of source code must retain the above copyright notice,
7 * this list of conditions and the following disclaimer.
8 * 2. Redistributions in binary form must reproduce the above copyright notice,
9 * this list of conditions and the following disclaimer in the documentation
10 * and/or other materials provided with the distribution.
11 * 3. Neither the name of STFC nor the names of its contributors may be used to
12 * endorse or promote products derived from this software without specific
13 * prior written permission.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
19 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25 * POSSIBILITY OF SUCH DAMAGE.
26 */
27
28#ifndef _OPALX_FIELDS_INTERPOLATOR3DGRIDTO3D_HH_
29#define _OPALX_FIELDS_INTERPOLATOR3DGRIDTO3D_HH_
30
35
36namespace interpolation {
37
53 public:
56
70 ThreeDGrid* grid, double*** Bx, double*** By, double*** Bz,
72
79
83
85 Interpolator3dGridTo3d* clone() const { return new Interpolator3dGridTo3d(*this); }
86
94 void function(const double Point[3], double Value[3]) const;
95
97 inline virtual void function(const Mesh::Iterator& point, double* value) const {
98 VectorMap::function(point, value);
99 }
100
103 void functionPrime(const double Point[3], double Value[3], int axis) const;
104
106 inline int getNumberOfXCoords() const;
107
109 inline int getNumberOfYCoords() const;
110
112 inline int getNumberOfZCoords() const;
113
115 inline unsigned int getPointDimension() const;
116
118 inline unsigned int getValueDimension() const;
119
121 inline ThreeDGrid* getMesh() const;
122
127 inline void setGrid(ThreeDGrid* grid);
128
133 inline void setX(int nCoords, double* x);
134
139 inline void setY(int nCoords, double* y);
140
145 inline void setZ(int nCoords, double* z);
146
149 void setAll(
150 ThreeDGrid* grid, double*** Bx, double*** By, double*** Bz,
152
154 inline void clear();
155
156 protected:
159 };
160
162
164
166
167 unsigned int Interpolator3dGridTo3d::getPointDimension() const { return 3; }
168
169 unsigned int Interpolator3dGridTo3d::getValueDimension() const { return 3; }
170
172
174 if (coordinates_m != nullptr) coordinates_m->remove(this);
175 grid->add(this);
176 coordinates_m = grid;
177 }
178
179 void Interpolator3dGridTo3d::setX(int nCoords, double* x) {
180 if (coordinates_m != nullptr) coordinates_m->setX(nCoords, x);
181 }
182
183 void Interpolator3dGridTo3d::setY(int nCoords, double* y) {
184 if (coordinates_m != nullptr) coordinates_m->setY(nCoords, y);
185 }
186
187 void Interpolator3dGridTo3d::setZ(int nCoords, double* z) {
188 if (coordinates_m != nullptr) coordinates_m->setZ(nCoords, z);
189 }
190
192 ThreeDGrid* grid, double*** Bx, double*** By, double*** Bz,
193 interpolationAlgorithm /*algo*/)
194 : coordinates_m(nullptr) {
195 for (int i = 0; i < 3; i++)
196 interpolator_m[i] = nullptr;
197 setAll(grid, Bx, By, Bz);
198 }
199
201 for (int i = 0; i < 3; i++)
202 delete interpolator_m[i];
203 coordinates_m->remove(this);
204 }
205
206} // namespace interpolation
207
208#endif
Definition Value.h:23
void function(const double Point[3], double Value[3]) const
void functionPrime(const double Point[3], double Value[3], int axis) const
void setAll(ThreeDGrid *grid, double ***Bx, double ***By, double ***Bz, interpolationAlgorithm algo=TRILINEAR)
Interpolator3dGridTo3d(ThreeDGrid *grid, double ***Bx, double ***By, double ***Bz, interpolationAlgorithm algo=TRILINEAR)
virtual void function(const Mesh::Iterator &point, double *value) const
Interpolator3dGridTo3d * clone() const
void setY(int nYCoords, double *y)
Definition ThreeDGrid.h:415
void setZ(int nZCoords, double *z)
Definition ThreeDGrid.h:417
void remove(VectorMap *map)
void setX(int nXCoords, double *x)
Definition ThreeDGrid.h:413
void add(VectorMap *map)
virtual void function(const double *point, double *value) const =0