36 #include <boost/shared_ptr.hpp>
81 Array<OneD, Array<OneD, NekDouble> >
m_pts;
89 Array<OneD, NekDouble > &intfields)
93 "Assumed only one coordinate given taking first coordinate "
95 int npts = m_pts[0].num_elements();
98 for(i = 0; i < npts-1; ++i)
100 if((m_pts[0][i] <= coord) && (coord <= m_pts[0][i+1]))
102 NekDouble pdiff = m_pts[0][i+1]-m_pts[0][i];
107 for(
int j = 0; j < m_nFields; ++j)
109 intfields[j] = m_pts[m_ptsDim+j][i]
110 * (m_pts[0][i+1] - coord) / pdiff
111 + m_pts[m_ptsDim+j][i+1]
112 * (coord - m_pts[0][i]) / pdiff;
119 NekDouble pdiff2 = m_pts[0][i+2] - m_pts[0][i+1];
122 * (m_pts[0][i+2] - coord)
123 / (pdiff * (pdiff+pdiff2));
125 * (m_pts[0][i+2] - coord)
128 * (coord - m_pts[0][i+1])
129 / ((pdiff + pdiff2) * pdiff2);
130 for(
int j = 0; j < m_nFields; ++j)
132 intfields[j] = m_pts[m_ptsDim+j][i] * h1
133 + m_pts[m_ptsDim+j][i+1] * h2
134 + m_pts[m_ptsDim+j][i+2] * h3;
139 NekDouble pdiff2 = m_pts[0][i] - m_pts[0][i-1];
142 * (coord - m_pts[0][i-1])
145 * (coord - m_pts[0][i-1])
146 / (pdiff * (pdiff + pdiff2));
148 * (m_pts[0][i+1] - coord)
149 / ((pdiff + pdiff2) * pdiff);
150 for(
int j = 0; j < m_nFields; ++j)
152 intfields[j] = m_pts[m_ptsDim+j][i] * h1
153 + m_pts[m_ptsDim+j][i+1] * h2
154 + m_pts[m_ptsDim+j][i-1] * h3;
162 ASSERTL0(i != npts-1,
"Failed to find coordinate " +
163 boost::lexical_cast<string>(coord) +
164 " within provided input points");
174 m_declareExpansionAsContField(false),
175 m_declareExpansionAsDisContField(false),
176 m_writeBndFld(false),
183 m_session->Finalise();
189 vector<MultiRegions::ExpListSharedPtr>
m_exp;
209 bool fldfilegiven =
false)
215 int expdim = m_graph->GetMeshDimension();
218 bool dealiasing =
false;
225 "Quasi-3D approach is only set up for 1 or 2 "
226 "homogeneous directions");
228 if (NumHomogeneousDir == 1)
239 nplanes = m_fielddef[0]->m_numModes[1];
240 ly = m_fielddef[0]->m_homogeneousLengths[0];
241 btype = m_fielddef[0]->m_basis[1];
245 m_session->LoadParameter(
"HomModesZ", nplanes);
246 m_session->LoadParameter(
"LY",ly);
259 if(m_declareExpansionAsContField||
260 m_declareExpansionAsDisContField)
262 ASSERTL0(
false,
"ContField2DHomogeneous1D or "
263 "DisContField2DHomogenenous1D has "
264 "not been implemented");
269 AllocateSharedPtr(m_session, Bkey, ly,
274 else if (NumHomogeneousDir == 2)
284 nylines = m_fielddef[0]->m_numModes[1];
285 nzlines = m_fielddef[0]->m_numModes[2];
286 ly = m_fielddef[0]->m_homogeneousLengths[0];
287 lz = m_fielddef[0]->m_homogeneousLengths[1];
288 btype1 = m_fielddef[0]->m_basis[1];
289 btype2 = m_fielddef[0]->m_basis[2];
293 m_session->LoadParameter(
"HomModesY", nylines);
294 m_session->LoadParameter(
"HomModesZ", nzlines);
295 m_session->LoadParameter(
"LY",ly);
296 m_session->LoadParameter(
"LZ",lz);
311 if(m_declareExpansionAsContField)
315 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
316 ly, lz, useFFT, dealiasing,
318 m_session->GetVariable(0));
320 else if(m_declareExpansionAsDisContField)
324 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
325 ly, lz, useFFT, dealiasing,
327 m_session->GetVariable(0));
333 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
334 ly, lz, useFFT, dealiasing,
344 if(m_declareExpansionAsContField)
348 m_session->GetVariable(0));
350 else if(m_declareExpansionAsDisContField)
354 m_session->GetVariable(0));
369 "NumHomogeneousDir is only set up for 1");
371 if (NumHomogeneousDir == 1)
382 nplanes = m_fielddef[0]->m_numModes[2];
383 lz = m_fielddef[0]->m_homogeneousLengths[0];
384 btype = m_fielddef[0]->m_basis[2];
388 m_session->LoadParameter(
"HomModesZ", nplanes);
389 m_session->LoadParameter(
"LZ",lz);
400 if(m_declareExpansionAsContField)
404 AllocateSharedPtr(m_session, Bkey, lz, useFFT,
406 m_session->GetVariable(0));
408 else if (m_declareExpansionAsDisContField)
412 AllocateSharedPtr(m_session,
415 m_session->GetVariable(0));
421 AllocateSharedPtr(m_session, Bkey, lz, useFFT,
422 dealiasing, m_graph);
430 if(m_declareExpansionAsContField)
434 m_session->GetVariable(0));
436 else if(m_declareExpansionAsDisContField)
440 m_session->GetVariable(0));
456 if(m_declareExpansionAsContField)
460 m_session->GetVariable(0));
462 else if(m_declareExpansionAsDisContField)
466 m_session->GetVariable(0));
478 ASSERTL0(
false,
"Expansion dimension not recognised");
486 string var =
"DefaultVar",
487 bool NewField =
false)
490 switch (m_graph->GetMeshDimension())
494 if (NumHomogeneousDir == 1)
496 ASSERTL0(m_declareExpansionAsContField ||
497 m_declareExpansionAsDisContField,
498 "ContField2DHomogeneous1D or "
499 "DisContField2DHomogenenous1D has not been "
508 AllocateSharedPtr(*tmp2);
511 else if (NumHomogeneousDir == 2)
513 if(m_declareExpansionAsContField)
521 AllocateSharedPtr(*tmp2);
523 else if(m_declareExpansionAsDisContField)
531 AllocateSharedPtr(*tmp2);
541 AllocateSharedPtr(*tmp2);
548 if(m_declareExpansionAsContField)
557 else if(m_declareExpansionAsDisContField)
581 if (NumHomogeneousDir == 1)
583 if(m_declareExpansionAsContField)
588 bool dealiasing =
false;
593 m_exp[0]->GetHomogeneousBasis()
595 m_exp[0]->GetHomoLen(),
596 useFFT, dealiasing, m_graph, var);
604 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
607 AllocateSharedPtr(*tmp2);
610 else if(m_declareExpansionAsDisContField)
615 bool dealiasing =
false;
620 m_exp[0]->GetHomogeneousBasis()
622 m_exp[0]->GetHomoLen(),
623 useFFT, dealiasing, m_graph,var);
630 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
634 AllocateSharedPtr(*tmp2);
642 bool dealiasing =
false;
647 m_exp[0]->GetHomogeneousBasis()
649 m_exp[0]->GetHomoLen(),
650 useFFT, dealiasing, m_graph);
657 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
661 AllocateSharedPtr(*tmp2);
668 if(m_declareExpansionAsContField)
686 else if(m_declareExpansionAsDisContField)
717 if(m_declareExpansionAsContField)
734 else if(m_declareExpansionAsDisContField)
763 ASSERTL0(
false,
"Expansion dimension not recognised");