115{
116 const TiXmlElement *funcNameElmt = pForce->FirstChildElement("COEFF");
118 "Requires COEFF tag, specifying function "
119 "name which prescribes absorption layer coefficient.");
120 string funcName = funcNameElmt->GetText();
122 "Function '" + funcName + "' not defined.");
123
124 int npts = pFields[0]->GetTotPoints();
125
128 {
130 }
131
132 funcNameElmt = pForce->FirstChildElement("BOUNDARYREGIONS");
133 if (funcNameElmt)
134 {
137 "Unable to process list of BOUNDARYREGIONS in Absorption "
138 "Forcing: " +
139 std::string(funcNameElmt->GetText()));
140
141
142 std::vector<unsigned int> localBRegions;
143 SpatialDomains::BoundaryConditions bcs(
m_session,
144 pFields[0]->GetGraph());
146 bcs.GetBoundaryRegions();
147 SpatialDomains::BoundaryRegionCollection::iterator it1;
148 int n = 0;
149 for (it1 = regions.begin(); it1 != regions.end(); ++it1)
150 {
153 {
154 localBRegions.push_back(n);
155 }
156 n++;
157 }
159
161 {
162 return;
163 }
164
165 std::vector<Array<OneD, const NekDouble>> points;
166
167 Array<OneD, Array<OneD, NekDouble>> x(3);
168 for (int i = 0; i < 3; i++)
169 {
170 x[i] = Array<OneD, NekDouble>(npts, 0.0);
171 }
172 pFields[0]->GetCoords(x[0], x[1], x[2]);
173 for (int i = 0; i < 3; i++)
174 {
175 points.push_back(x[i]);
176 }
177
178 Array<OneD, NekDouble> t(npts, 0.0);
179 points.push_back(t);
180
181 Array<OneD, NekDouble> r(npts, 0.0);
182 std::vector<unsigned int>::iterator it;
183 std::vector<BPointPair> inPoints;
184 Array<OneD, Array<OneD, NekDouble>> b(3);
186 {
187 int bpts = pFields[0]->GetBndCondExpansions()[*it]->GetNpoints();
188 for (int i = 0; i < 3; i++)
189 {
190 b[i] = Array<OneD, NekDouble>(bpts, 0.0);
191 }
192 pFields[0]->GetBndCondExpansions()[*it]->GetCoords(b[0], b[1],
193 b[2]);
194 for (int i = 0;
195 i < pFields[0]->GetBndCondExpansions()[*it]->GetNpoints(); ++i)
196 {
197 inPoints.push_back(
199 }
200 }
202 m_rtree->insert(inPoints.begin(), inPoints.end());
203
204 for (int i = 0; i < npts; ++i)
205 {
206 std::vector<BPointPair> result;
207 BPoint sPoint(x[0][i], x[1][i], x[2][i]);
208 m_rtree->query(bgi::nearest(sPoint, 1), std::back_inserter(result));
209 r[i] = bg::distance(sPoint, result[0].first);
210 }
211 points.push_back(r);
212
213 std::string s_FieldStr;
215 {
218 "Variable '" + s_FieldStr + "' not defined.");
219
221 m_session->GetFunction(funcName, s_FieldStr);
222 ASSERTL0(ffunc->GetVlist() ==
"x y z t r",
223 "EVARS of " + funcName + " must be 'r'");
224
226 }
227 }
228 else
229 {
231 {
232 std::string s_FieldStr =
m_session->GetVariable(i);
235 }
236 }
237}
#define ASSERTL0(condition, msg)
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
bg::model::point< NekDouble, 3, bg::cs::cartesian > BPoint
std::pair< BPoint, unsigned int > BPointPair
std::shared_ptr< BRTree > m_rtree
std::vector< unsigned int > m_bRegions
Array< OneD, Array< OneD, NekDouble > > m_Absorption
int m_NumVariable
Number of variables.
SOLVER_UTILS_EXPORT SessionFunctionSharedPtr GetFunction(const Array< OneD, MultiRegions::ExpListSharedPtr > &pFields, const LibUtilities::SessionReaderSharedPtr &pSession, std::string pName, bool pCache=false)
Get a SessionFunction by name.
LibUtilities::SessionReaderSharedPtr m_session
Session reader.
std::shared_ptr< Equation > EquationSharedPtr
std::map< int, BoundaryRegionShPtr > BoundaryRegionCollection
InputIterator find(InputIterator first, InputIterator last, InputIterator startingpoint, const EqualityComparable &value)