36 #include <boost/shared_ptr.hpp>
79 Array<OneD, Array<OneD, NekDouble> >
m_pts;
88 Array<OneD, NekDouble > &intfields)
92 "Assumed only one coordinate given taking first coordinate "
94 int npts = m_pts[0].num_elements();
97 for(i = 0; i < npts-1; ++i)
99 if((m_pts[0][i] <= coord) && (coord <= m_pts[0][i+1]))
101 NekDouble pdiff = m_pts[0][i+1]-m_pts[0][i];
106 for(
int j = 0; j < m_nFields; ++j)
108 intfields[j] = m_pts[m_ptsDim+j][i]
109 * (m_pts[0][i+1] - coord) / pdiff
110 + m_pts[m_ptsDim+j][i+1]
111 * (coord - m_pts[0][i]) / pdiff;
118 NekDouble pdiff2 = m_pts[0][i+2] - m_pts[0][i+1];
121 * (m_pts[0][i+2] - coord)
122 / (pdiff * (pdiff+pdiff2));
124 * (m_pts[0][i+2] - coord)
127 * (coord - m_pts[0][i+1])
128 / ((pdiff + pdiff2) * pdiff2);
129 for(
int j = 0; j < m_nFields; ++j)
131 intfields[j] = m_pts[m_ptsDim+j][i] * h1
132 + m_pts[m_ptsDim+j][i+1] * h2
133 + m_pts[m_ptsDim+j][i+2] * h3;
138 NekDouble pdiff2 = m_pts[0][i] - m_pts[0][i-1];
141 * (coord - m_pts[0][i-1])
144 * (coord - m_pts[0][i-1])
145 / (pdiff * (pdiff + pdiff2));
147 * (m_pts[0][i+1] - coord)
148 / ((pdiff + pdiff2) * pdiff);
149 for(
int j = 0; j < m_nFields; ++j)
151 intfields[j] = m_pts[m_ptsDim+j][i] * h1
152 + m_pts[m_ptsDim+j][i+1] * h2
153 + m_pts[m_ptsDim+j][i-1] * h3;
160 ASSERTL0(i != npts-1,
"Failed to find coordinate " +
161 boost::lexical_cast<string>(coord) +
162 " within provided input points");
172 m_declareExpansionAsContField(false),
173 m_declareExpansionAsDisContField(false),
174 m_writeBndFld(false),
181 m_session->Finalise();
187 vector<MultiRegions::ExpListSharedPtr>
m_exp;
206 bool fldfilegiven =
false)
212 int expdim = m_graph->GetMeshDimension();
215 bool dealiasing =
false;
222 "Quasi-3D approach is only set up for 1 or 2 "
223 "homogeneous directions");
225 if (NumHomogeneousDir == 1)
236 nplanes = m_fielddef[0]->m_numModes[1];
237 ly = m_fielddef[0]->m_homogeneousLengths[0];
238 btype = m_fielddef[0]->m_basis[1];
242 m_session->LoadParameter(
"HomModesZ", nplanes);
243 m_session->LoadParameter(
"LY",ly);
256 if(m_declareExpansionAsContField||
257 m_declareExpansionAsDisContField)
259 ASSERTL0(
false,
"ContField2DHomogeneous1D or "
260 "DisContField2DHomogenenous1D has "
261 "not been implemented");
266 AllocateSharedPtr(m_session, Bkey, ly,
271 else if (NumHomogeneousDir == 2)
281 nylines = m_fielddef[0]->m_numModes[1];
282 nzlines = m_fielddef[0]->m_numModes[2];
283 ly = m_fielddef[0]->m_homogeneousLengths[0];
284 lz = m_fielddef[0]->m_homogeneousLengths[1];
285 btype1 = m_fielddef[0]->m_basis[1];
286 btype2 = m_fielddef[0]->m_basis[2];
290 m_session->LoadParameter(
"HomModesY", nylines);
291 m_session->LoadParameter(
"HomModesZ", nzlines);
292 m_session->LoadParameter(
"LY",ly);
293 m_session->LoadParameter(
"LZ",lz);
308 if(m_declareExpansionAsContField)
312 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
313 ly, lz, useFFT, dealiasing,
315 m_session->GetVariable(0));
317 else if(m_declareExpansionAsDisContField)
321 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
322 ly, lz, useFFT, dealiasing,
324 m_session->GetVariable(0));
330 AllocateSharedPtr(m_session, BkeyY, BkeyZ,
331 ly, lz, useFFT, dealiasing,
341 if(m_declareExpansionAsContField)
345 m_session->GetVariable(0));
347 else if(m_declareExpansionAsDisContField)
351 m_session->GetVariable(0));
366 "NumHomogeneousDir is only set up for 1");
368 if (NumHomogeneousDir == 1)
379 nplanes = m_fielddef[0]->m_numModes[2];
380 lz = m_fielddef[0]->m_homogeneousLengths[0];
381 btype = m_fielddef[0]->m_basis[2];
385 m_session->LoadParameter(
"HomModesZ", nplanes);
386 m_session->LoadParameter(
"LZ",lz);
397 if(m_declareExpansionAsContField)
401 AllocateSharedPtr(m_session, Bkey, lz, useFFT,
403 m_session->GetVariable(0));
405 else if (m_declareExpansionAsDisContField)
409 AllocateSharedPtr(m_session,
412 m_session->GetVariable(0));
418 AllocateSharedPtr(m_session, Bkey, lz, useFFT,
419 dealiasing, m_graph);
427 if(m_declareExpansionAsContField)
431 m_session->GetVariable(0));
433 else if(m_declareExpansionAsDisContField)
437 m_session->GetVariable(0));
453 if(m_declareExpansionAsContField)
457 m_session->GetVariable(0));
459 else if(m_declareExpansionAsDisContField)
463 m_session->GetVariable(0));
475 ASSERTL0(
false,
"Expansion dimension not recognised");
483 string var =
"DefaultVar",
484 bool NewField =
false)
487 switch (m_graph->GetMeshDimension())
491 if (NumHomogeneousDir == 1)
493 ASSERTL0(m_declareExpansionAsContField ||
494 m_declareExpansionAsDisContField,
495 "ContField2DHomogeneous1D or "
496 "DisContField2DHomogenenous1D has not been "
505 AllocateSharedPtr(*tmp2);
508 else if (NumHomogeneousDir == 2)
510 if(m_declareExpansionAsContField)
518 AllocateSharedPtr(*tmp2);
520 else if(m_declareExpansionAsDisContField)
528 AllocateSharedPtr(*tmp2);
538 AllocateSharedPtr(*tmp2);
545 if(m_declareExpansionAsContField)
554 else if(m_declareExpansionAsDisContField)
578 if (NumHomogeneousDir == 1)
580 if(m_declareExpansionAsContField)
585 bool dealiasing =
false;
590 m_exp[0]->GetHomogeneousBasis()
592 m_exp[0]->GetHomoLen(),
593 useFFT, dealiasing, m_graph, var);
601 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
604 AllocateSharedPtr(*tmp2);
607 else if(m_declareExpansionAsDisContField)
612 bool dealiasing =
false;
617 m_exp[0]->GetHomogeneousBasis()
619 m_exp[0]->GetHomoLen(),
620 useFFT, dealiasing, m_graph,var);
627 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
631 AllocateSharedPtr(*tmp2);
639 bool dealiasing =
false;
644 m_exp[0]->GetHomogeneousBasis()
646 m_exp[0]->GetHomoLen(),
647 useFFT, dealiasing, m_graph);
654 ASSERTL0(tmp2,
"Failed to type cast m_exp[0]");
658 AllocateSharedPtr(*tmp2);
665 if(m_declareExpansionAsContField)
683 else if(m_declareExpansionAsDisContField)
714 if(m_declareExpansionAsContField)
731 else if(m_declareExpansionAsDisContField)
760 ASSERTL0(
false,
"Expansion dimension not recognised");