45 namespace MultiRegions
62 m_dealiasing(dealiasing)
69 m_comm->GetColumnComm()->GetColumnComm() :
96 ASSERTL0(
false,
"Dealiasing available just in combination "
108 m_transposition(In.m_transposition),
109 m_StripZcomm(In.m_StripZcomm),
110 m_useFFT(In.m_useFFT),
113 m_tmpOUT(In.m_tmpOUT),
114 m_homogeneousBasis(In.m_homogeneousBasis),
116 m_homogeneous1DBlockMat(In.m_homogeneous1DBlockMat),
117 m_dealiasing(In.m_dealiasing),
118 m_padsize(In.m_padsize)
124 const std::vector<unsigned int> &eIDs):
126 m_transposition(In.m_transposition),
127 m_useFFT(In.m_useFFT),
130 m_tmpOUT(In.m_tmpOUT),
131 m_homogeneousBasis(In.m_homogeneousBasis),
134 m_dealiasing(In.m_dealiasing),
135 m_padsize(In.m_padsize)
179 int num_dofs = inarray1.num_elements();
190 int num_points_per_plane = num_dofs/
m_planes.num_elements();
192 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
194 num_proc =
m_comm->GetColumnComm()->GetSize();
200 int num_dfts_per_proc = num_points_per_plane / num_proc
201 + (num_points_per_plane % num_proc > 0);
219 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
223 Vmath::Vcopy(N, &(ShufV1[i*N]), 1, &(ShufV1_PAD_coef[0]), 1);
224 Vmath::Vcopy(N, &(ShufV2[i*N]), 1, &(ShufV2_PAD_coef[0]), 1);
227 m_FFT_deal->FFTBwdTrans(ShufV1_PAD_coef, ShufV1_PAD_phys);
228 m_FFT_deal->FFTBwdTrans(ShufV2_PAD_coef, ShufV2_PAD_phys);
234 ShufV1V2_PAD_phys, 1);
238 m_FFT_deal->FFTFwdTrans(ShufV1V2_PAD_phys, ShufV1V2_PAD_coef);
243 &(ShufV1V2[i*N]), 1);
258 int cnt = 0, cnt1 = 0;
261 for(
int n = 0; n <
m_planes.num_elements(); ++n)
263 m_planes[n]->FwdTrans(inarray+cnt, tmparray = outarray + cnt1,
280 int cnt = 0, cnt1 = 0;
284 for(
int n = 0; n <
m_planes.num_elements(); ++n)
286 m_planes[n]->FwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
301 int cnt = 0, cnt1 = 0;
304 for(
int n = 0; n <
m_planes.num_elements(); ++n)
306 m_planes[n]->BwdTrans(inarray+cnt, tmparray = outarray + cnt1,
309 cnt1 +=
m_planes[n]->GetTotPoints();
322 int cnt = 0, cnt1 = 0;
325 for(
int n = 0; n <
m_planes.num_elements(); ++n)
327 m_planes[n]->BwdTrans_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
330 cnt1 +=
m_planes[n]->GetTotPoints();
343 int cnt = 0, cnt1 = 0;
346 for(
int n = 0; n <
m_planes.num_elements(); ++n)
348 m_planes[n]->IProductWRTBase(inarray+cnt, tmparray = outarray + cnt1,coeffstate);
360 int cnt = 0, cnt1 = 0;
363 for(
int n = 0; n <
m_planes.num_elements(); ++n)
365 m_planes[n]->IProductWRTBase_IterPerExp(inarray+cnt, tmparray = outarray + cnt1);
385 num_dofs = inarray.num_elements();
389 num_dofs = outarray.num_elements();
394 int num_points_per_plane = num_dofs/
m_planes.num_elements();
395 int num_dfts_per_proc;
396 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
398 int nP =
m_comm->GetColumnComm()->GetSize();
399 num_dfts_per_proc = num_points_per_plane / nP
400 + (num_points_per_plane % nP > 0);
405 num_dfts_per_proc = num_points_per_plane / nP
406 + (num_points_per_plane % nP > 0);
424 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
431 for(
int i = 0 ; i < num_dfts_per_proc ; i++)
444 fft_out,1,outarray,1);
474 int nrows = blkmat->GetRows();
475 int ncols = blkmat->GetColumns();
519 return matrixIter->second;
529 int num_trans_per_proc = 0;
538 n_exp =
m_planes[0]->GetTotPoints();
541 num_trans_per_proc = n_exp/
m_comm->GetColumnComm()->GetSize() + (n_exp%
m_comm->GetColumnComm()->GetSize() > 0);
569 StdPoint.DetShapeType(),
572 loc_mat = StdPoint.GetStdMatrix(matkey);
577 StdPoint.DetShapeType(),
580 loc_mat = StdPoint.GetStdMatrix(matkey);
591 StdSeg.DetShapeType(),
594 loc_mat = StdSeg.GetStdMatrix(matkey);
599 StdSeg.DetShapeType(),
602 loc_mat = StdSeg.GetStdMatrix(matkey);
608 for(
int i = 0; i < num_trans_per_proc; ++i)
610 BlkMatrix->SetBlock(i,i,loc_mat);
618 std::vector<LibUtilities::FieldDefinitionsSharedPtr> returnval;
623 std::vector<NekDouble> HomoLen;
624 HomoLen.push_back(
m_lhom);
626 std::vector<unsigned int> StripsIDs;
629 m_session->MatchSolverInfo(
"HomoStrip",
"True",strips,
false);
635 std::vector<unsigned int> PlanesIDs;
645 for(
int i = 0; i <
m_planes.num_elements(); i++)
650 m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis,
651 HomoLen, strips, StripsIDs, PlanesIDs);
660 std::vector<NekDouble> HomoLen;
661 HomoLen.push_back(
m_lhom);
663 std::vector<unsigned int> StripsIDs;
666 m_session->MatchSolverInfo(
"HomoStrip",
"True",strips,
false);
672 std::vector<unsigned int> PlanesIDs;
680 for(
int i = 0; i <
m_planes.num_elements(); i++)
686 m_planes[0]->GeneralGetFieldDefinitions(fielddef, 1, HomoBasis,
687 HomoLen, strips, StripsIDs, PlanesIDs);
700 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
704 map<int, int> ElmtID_to_ExpID;
705 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
707 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
710 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
712 int eid = ElmtID_to_ExpID[fielddef->m_elementIDs[i]];
713 int datalen = (*m_exp)[eid]->GetNcoeffs();
715 for(n = 0; n <
m_planes.num_elements(); ++n)
717 fielddata.insert(fielddata.end(),&coeffs[
m_coeff_offset[eid]+n*ncoeffs_per_plane],&coeffs[m_coeff_offset[eid]+n*ncoeffs_per_plane]+datalen);
730 std::vector<NekDouble> &fielddata,
737 int datalen = fielddata.size()/fielddef->m_fields.size();
738 std::vector<unsigned int> fieldDefHomoZids;
742 for(i = 0; i < fielddef->m_fields.size(); ++i)
744 if(fielddef->m_fields[i] == field)
751 if(i == fielddef->m_fields.size())
753 cout <<
"Field "<< field<<
"not found in data file. " << endl;
758 int modes_offset = 0;
759 int planes_offset = 0;
772 std::map<int,int> homoZids;
773 for (i = 0; i <
m_planes.num_elements(); ++i)
778 if(fielddef->m_numHomogeneousDir)
780 nzmodes = fielddef->m_homogeneousZIDs.size();
781 fieldDefHomoZids = fielddef->m_homogeneousZIDs;
786 fieldDefHomoZids.push_back(0);
790 map<int, int> ElmtID_to_ExpID;
791 for(i = 0; i <
m_planes[0]->GetExpSize(); ++i)
793 ElmtID_to_ExpID[(*m_exp)[i]->GetGeom()->GetGlobalID()] = i;
798 int ncoeffs_per_plane =
m_planes[0]->GetNcoeffs();
800 for(i = 0; i < fielddef->m_elementIDs.size(); ++i)
802 if(fielddef->m_uniOrder ==
true)
808 fielddef->m_numModes,
811 it = ElmtID_to_ExpID.find(fielddef->m_elementIDs[i]);
814 if(it == ElmtID_to_ExpID.end())
817 offset += datalen*nzmodes;
818 modes_offset += (*m_exp)[0]->GetNumBases() +
819 fielddef->m_numHomogeneousDir;
823 int eid = it->second;
826 for(n = 0; n < nzmodes; ++n, offset += datalen)
829 it = homoZids.find(fieldDefHomoZids[n]);
832 if (it == homoZids.end())
837 planes_offset = it->second;
838 if(datalen == (*
m_exp)[eid]->GetNcoeffs())
844 (*m_exp)[eid]->ExtractDataToCoeffs(&fielddata[offset], fielddef->m_numModes,modes_offset,&coeffs[
m_coeff_offset[eid] + planes_offset*ncoeffs_per_plane]);
847 modes_offset += (*m_exp)[0]->GetNumBases() + fielddef->m_numHomogeneousDir;
857 int fromNcoeffs_per_plane = fromExpList->GetPlane(0)->GetNcoeffs();
858 int toNcoeffs_per_plane =
m_planes[0]->GetNcoeffs();
861 for(i = 0; i <
m_planes.num_elements(); ++i)
863 m_planes[i]->ExtractCoeffsToCoeffs(fromExpList->GetPlane(i),fromcoeffs_tmp = fromCoeffs + fromNcoeffs_per_plane*i, tocoeffs_tmp = toCoeffs + toNcoeffs_per_plane*i);
873 m_planes[0]->WriteVtkPieceData(outfile, expansion, var);
878 int nq = (*m_exp)[expansion]->GetTotPoints();
879 int npoints_per_plane =
m_planes[0]->GetTotPoints();
882 outfile <<
" <DataArray type=\"Float32\" Name=\""
883 << var <<
"\">" << endl;
885 for (
int n = 0; n <
m_planes.num_elements(); ++n)
888 for(i = 0; i < nq; ++i)
894 outfile <<
" </DataArray>" << endl;
902 cnt1 =
m_planes[0]->Get1DScaledTotPoints(scale);
904 ASSERTL1(
m_planes.num_elements()*cnt1 <= outarray.num_elements(),
"size of outarray does not match internal estimage");
907 for(
int i = 0; i <
m_planes.num_elements(); i++)
910 m_planes[i]->PhysInterp1DScaled(scale,inarray+i*cnt,
911 tmparray = outarray+i*cnt1);
920 cnt =
m_planes[0]->Get1DScaledTotPoints(scale);
923 ASSERTL1(
m_planes.num_elements()*cnt <= inarray.num_elements(),
"size of outarray does not match internal estimage");
926 for(
int i = 0; i <
m_planes.num_elements(); i++)
928 m_planes[i]->PhysGalerkinProjection1DScaled(scale,inarray+i*cnt,
929 tmparray = outarray+i*cnt1);
938 int nT_pts = inarray.num_elements();
939 int nP_pts = nT_pts/
m_planes.num_elements();
947 for(
int i = 0; i <
m_planes.num_elements(); i++)
949 m_planes[i]->PhysDeriv(inarray + i*nP_pts ,tmp2 = out_d0 + i*nP_pts , tmp3 = out_d1 + i*nP_pts );
986 for(
int i = 0; i <
m_planes.num_elements(); i++)
990 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
1007 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
1010 "Parallelisation in the homogeneous direction "
1011 "implemented just for Fourier basis");
1016 "Parallelisation in the homogeneous direction "
1017 "implemented just for Fourier basis");
1022 ASSERTL0(
false,
"Semi-phyisical time-stepping not "
1023 "implemented yet for non-Fourier "
1032 for(
int i = 0; i < nP_pts; i++)
1034 StdSeg.PhysDeriv(temparray + i*
m_planes.num_elements(), tmp2 = outarray + i*
m_planes.num_elements());
1049 int nT_pts = inarray.num_elements();
1050 int nP_pts = nT_pts/
m_planes.num_elements();
1061 for(
int i=0; i <
m_planes.num_elements(); i++)
1063 m_planes[i]->PhysDeriv(edir, inarray + i*nP_pts ,tmp2 = out_d + i*nP_pts);
1073 temparray = inarray;
1099 for(
int i = 0; i <
m_planes.num_elements(); i++)
1103 Vmath::Smul(nP_pts,beta,tmp1 = temparray + i*nP_pts,1,tmp2 = outarray + (i-
int(sign))*nP_pts,1);
1119 if(!
m_session->DefinesSolverInfo(
"HomoStrip"))
1122 "Parallelisation in the homogeneous direction "
1123 "implemented just for Fourier basis");
1128 "Parallelisation in the homogeneous direction "
1129 "implemented just for Fourier basis");
1134 ASSERTL0(
false,
"Semi-phyisical time-stepping not implemented yet for non-Fourier basis");
1142 for(
int i = 0; i < nP_pts; i++)
1144 StdSeg.PhysDeriv(temparray + i*
m_planes.num_elements(), tmp2 = outarray + i*
m_planes.num_elements());
Abstraction of a two-dimensional multi-elemental expansion which is merely a collection of local expa...
void HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Homo1DBlockMatrixMapShPtr m_homogeneous1DBlockMat
virtual void v_FwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
#define ASSERTL0(condition, msg)
DNekBlkMatSharedPtr GetHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
virtual void v_PhysGalerkinProjection1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
boost::shared_ptr< Transposition > TranspositionSharedPtr
tBaseSharedPtr CreateInstance(tKey idKey BOOST_PP_COMMA_IF(MAX_PARAM) BOOST_PP_ENUM_BINARY_PARAMS(MAX_PARAM, tParam, x))
Create an instance of the class referred to by idKey.
static Array< OneD, NekDouble > NullNekDouble1DArray
static boost::shared_ptr< DataType > AllocateSharedPtr()
Allocate a shared pointer from the memory pool.
#define sign(a, b)
return the sign(b)*a
LibUtilities::TranspositionSharedPtr m_transposition
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion, std::string var)
virtual void v_PhysInterp1DScaled(const NekDouble scale, const Array< OneD, NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
void PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
virtual void v_ExtractCoeffsToCoeffs(const boost::shared_ptr< ExpList > &fromExpList, const Array< OneD, const NekDouble > &fromCoeffs, Array< OneD, NekDouble > &toCoeffs)
boost::shared_ptr< FieldDefinitions > FieldDefinitionsSharedPtr
LibUtilities::NektarFFTSharedPtr m_FFT_deal
static BasisSharedPtr NullBasisSharedPtr
Array< OneD, NekDouble > m_tmpOUT
NekDouble m_lhom
Width of homogeneous direction.
Array< OneD, NekDouble > m_phys
The global expansion evaluated at the quadrature points.
virtual void v_HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
Array< OneD, NekDouble > m_coeffs
Concatenation of all local expansion coefficients.
boost::shared_ptr< DNekMat > DNekMatSharedPtr
NektarFFTFactory & GetNektarFFTFactory()
boost::shared_ptr< SessionReader > SessionReaderSharedPtr
virtual LibUtilities::TranspositionSharedPtr v_GetTransposition(void)
int GetNumberOfCoefficients(ShapeType shape, std::vector< unsigned int > &modes, int offset)
virtual void v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata)
BasisManagerT & BasisManager(void)
Class representing a segment element in reference space.
virtual void v_IProductWRTBase(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
Array< OneD, int > m_coeff_offset
Offset of elemental data into the array m_coeffs.
LibUtilities::BasisSharedPtr m_homogeneousBasis
Definition of the total number of degrees of freedom and quadrature points. Sets up the storage for m...
Base class for all multi-elemental spectral/hp expansions.
static const NekDouble kNekZeroTol
Fourier Modified expansions with just the real part of the first mode .
void Smul(int n, const T alpha, const T *x, const int incx, T *y, const int incy)
Scalar multiply y = alpha*y.
boost::shared_ptr< LocalRegions::ExpansionVector > m_exp
The list of local expansions.
Array< OneD, int > m_phys_offset
Offset of elemental data into the array m_phys.
virtual void v_BwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate)
virtual void v_BwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
LibUtilities::SessionReaderSharedPtr m_session
Session.
Array< OneD, ExpListSharedPtr > m_planes
void HomogeneousFwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual void v_FwdTrans_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
virtual void v_HomogeneousBwdTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
ExpListHomogeneous1D()
Default constructor.
Array< OneD, NekDouble > m_tmpIN
Fourier Modified expansions with just the imaginary part of the first mode .
virtual Array< OneD, const unsigned int > v_GetZIDs(void)
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector< NekDouble > &fielddata, std::string &field, Array< OneD, NekDouble > &coeffs)
Extract data from raw field data into expansion list.
boost::shared_ptr< DNekBlkMat > DNekBlkMatSharedPtr
StandardMatrixTag boost::call_traits< LhsDataType >::const_reference rhs typedef NekMatrix< LhsDataType, StandardMatrixTag >::iterator iterator
virtual void v_DealiasedProd(const Array< OneD, NekDouble > &inarray1, const Array< OneD, NekDouble > &inarray2, Array< OneD, NekDouble > &outarray, CoeffState coeffstate=eLocal)
LibUtilities::CommSharedPtr m_comm
Communicator.
void Homogeneous1DTrans(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray, bool IsForwards, CoeffState coeffstate=eLocal, bool Shuff=true, bool UnShuff=true)
virtual std::vector< LibUtilities::FieldDefinitionsSharedPtr > v_GetFieldDefinitions(void)
DNekBlkMatSharedPtr GenHomogeneous1DBlockMatrix(Homogeneous1DMatType mattype, CoeffState coeffstate=eLocal) const
map< Homogeneous1DMatType, DNekBlkMatSharedPtr > Homo1DBlockMatrixMap
A map between homo matrix keys and their associated block matrices.
virtual void v_IProductWRTBase_IterPerExp(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &outarray)
Fourier ModifiedExpansion with just the first mode .
virtual ~ExpListHomogeneous1D()
Destructor.
#define ASSERTL2(condition, msg)
Assert Level 2 – Debugging which is used FULLDEBUG compilation mode. This level assert is designed t...
LibUtilities::CommSharedPtr m_StripZcomm
bool m_useFFT
FFT variables.
static const BasisKey NullBasisKey(eNoBasisType, 0, NullPointsKey)
Defines a null basis with no type or points.
virtual NekDouble v_GetHomoLen(void)
#define ASSERTL1(condition, msg)
Assert Level 1 – Debugging which is used whether in FULLDEBUG or DEBUG compilation mode...
void Vcopy(int n, const T *x, const int incx, T *y, const int incy)
virtual void v_PhysDeriv(const Array< OneD, const NekDouble > &inarray, Array< OneD, NekDouble > &out_d0, Array< OneD, NekDouble > &out_d1, Array< OneD, NekDouble > &out_d2)
Describes the specification for a Basis.
void Vmul(int n, const T *x, const int incx, const T *y, const int incy, T *z, const int incz)
Multiply vector z = x*y.
LibUtilities::NektarFFTSharedPtr m_FFT