114{
115 const TiXmlElement *funcNameElmt = pForce->FirstChildElement("COEFF");
117 "Requires COEFF tag, specifying function "
118 "name which prescribes absorption layer coefficient.");
119 std::string funcName = funcNameElmt->GetText();
121 "Function '" + funcName + "' not defined.");
122
123 int npts = pFields[0]->GetTotPoints();
124
127 {
129 }
130
131 funcNameElmt = pForce->FirstChildElement("BOUNDARYREGIONS");
132 if (funcNameElmt)
133 {
136 "Unable to process list of BOUNDARYREGIONS in Absorption "
137 "Forcing: " +
138 std::string(funcNameElmt->GetText()));
139
140
141 std::vector<unsigned int> localBRegions;
142 SpatialDomains::BoundaryConditions bcs(
m_session,
143 pFields[0]->GetGraph());
145 bcs.GetBoundaryRegions();
146 SpatialDomains::BoundaryRegionCollection::iterator it1;
147 int n = 0;
148 for (it1 = regions.begin(); it1 != regions.end(); ++it1)
149 {
152 {
153 localBRegions.push_back(n);
154 }
155 n++;
156 }
158
160 {
161 return;
162 }
163
164 std::vector<Array<OneD, const NekDouble>> points;
165
166 Array<OneD, Array<OneD, NekDouble>> x(3);
167 for (int i = 0; i < 3; i++)
168 {
169 x[i] = Array<OneD, NekDouble>(npts, 0.0);
170 }
171 pFields[0]->GetCoords(x[0], x[1], x[2]);
172 for (int i = 0; i < 3; i++)
173 {
174 points.push_back(x[i]);
175 }
176
177 Array<OneD, NekDouble> t(npts, 0.0);
178 points.push_back(t);
179
180 Array<OneD, NekDouble> r(npts, 0.0);
181 std::vector<unsigned int>::iterator it;
182 std::vector<BPointPair> inPoints;
183 Array<OneD, Array<OneD, NekDouble>> b(3);
185 {
186 int bpts = pFields[0]->GetBndCondExpansions()[*it]->GetNpoints();
187 for (int i = 0; i < 3; i++)
188 {
189 b[i] = Array<OneD, NekDouble>(bpts, 0.0);
190 }
191 pFields[0]->GetBndCondExpansions()[*it]->GetCoords(b[0], b[1],
192 b[2]);
193 for (int i = 0;
194 i < pFields[0]->GetBndCondExpansions()[*it]->GetNpoints(); ++i)
195 {
196 inPoints.push_back(
198 }
199 }
201 m_rtree->insert(inPoints.begin(), inPoints.end());
202
203 for (int i = 0; i < npts; ++i)
204 {
205 std::vector<BPointPair> result;
206 BPoint sPoint(x[0][i], x[1][i], x[2][i]);
207 m_rtree->query(bgi::nearest(sPoint, 1), std::back_inserter(result));
208 r[i] = bg::distance(sPoint, result[0].first);
209 }
210 points.push_back(r);
211
212 std::string s_FieldStr;
214 {
217 "Variable '" + s_FieldStr + "' not defined.");
218
220 m_session->GetFunction(funcName, s_FieldStr);
221 ASSERTL0(ffunc->GetVlist() ==
"x y z t r",
222 "EVARS of " + funcName + " must be 'r'");
223
225 }
226 }
227 else
228 {
230 {
231 std::string s_FieldStr =
m_session->GetVariable(i);
234 }
235 }
236
237
238
240 {
242 {
243 pFields[i]->HomogeneousFwdTrans(pFields[i]->GetTotPoints(),
245 }
246 }
247}
#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)