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