OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
Interpolator3dGridTo1d.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_INTERPOLATOR3DGRIDTO1D_H_
29#define _OPALX_FIELDS_INTERPOLATOR3DGRIDTO1D_H_
30
33
34namespace interpolation {
35
45 public:
54 inline Interpolator3dGridTo1d(ThreeDGrid* grid, double*** F);
55
61
63 inline virtual ~Interpolator3dGridTo1d();
64
66 inline virtual void function(const Mesh::Iterator& point, double* value) const {
67 VectorMap::function(point, value);
68 }
69
71 virtual void function(const double Point[3], double Value[1]) const = 0;
72
74 virtual Interpolator3dGridTo1d* clone() const = 0;
75
77 inline int getNumberOfXCoords() const;
78
80 inline int getNumberOfYCoords() const;
81
84 inline int getNumberOfZCoords() const;
85
87 inline unsigned int getPointDimension() const;
88
90 inline unsigned int getValueDimension() const;
91
93 inline ThreeDGrid* getMesh() const;
94
99 inline void setGrid(ThreeDGrid* grid);
100
105 inline void setX(int nCoords, double* x);
106
111 inline void setY(int nCoords, double* y);
112
117 inline void setZ(int nCoords, double* z);
118
121 inline void setF(double*** inF);
122
125 void deleteFunc(double*** func);
126
129 inline double*** function() const;
130
133 inline void setAll(ThreeDGrid* grid, double*** F);
134
136 inline void clear();
137
138 protected:
140 double*** f_m;
141 };
142
144 : coordinates_m(nullptr), f_m(nullptr) {
145 setAll(grid, F);
146 }
147
148 Interpolator3dGridTo1d::Interpolator3dGridTo1d() : coordinates_m(nullptr), f_m(nullptr) {}
149
151
153
155
157
158 unsigned int Interpolator3dGridTo1d::getPointDimension() const { return 3; }
159
160 unsigned int Interpolator3dGridTo1d::getValueDimension() const { return 1; }
161
163
164 void Interpolator3dGridTo1d::setF(double*** inF) {
166 f_m = inF;
167 }
168
170 if (coordinates_m != nullptr) coordinates_m->remove(this);
171 grid->add(this);
172 coordinates_m = grid;
173 }
174
175 void Interpolator3dGridTo1d::setX(int nCoords, double* x) {
176 if (coordinates_m != nullptr) coordinates_m->setX(nCoords, x);
177 }
178
179 void Interpolator3dGridTo1d::setY(int nCoords, double* y) {
180 if (coordinates_m != nullptr) coordinates_m->setY(nCoords, y);
181 }
182
183 void Interpolator3dGridTo1d::setZ(int nCoords, double* z) {
184 if (coordinates_m != nullptr) coordinates_m->setZ(nCoords, z);
185 }
186
187 double*** Interpolator3dGridTo1d::function() const { return f_m; }
188
190 setGrid(grid);
191 setF(F);
192 }
193
198
199} // namespace interpolation
200#endif // _OPALX_FIELDS_INTERPOLATOR3DGRIDTO1D_HH_
Definition Value.h:23
virtual void function(const Mesh::Iterator &point, double *value) const
virtual void function(const double Point[3], double Value[1]) const =0
virtual Interpolator3dGridTo1d * clone() const =0
void setAll(ThreeDGrid *grid, double ***F)
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