Commit 1c576935 authored by Chris Cantwell's avatar Chris Cantwell

Merge branch 'fix/3DH2D' into 'master'

Fix bug in ExpListHomogeneous2D

This fixes a bug which prevents FieldConvert from working with 3DH2D field files.

See merge request !529
parents 42eac4cf 9e42f073
......@@ -588,8 +588,24 @@ namespace Nektar
std::vector<NekDouble> HomoLen(2);
HomoLen[0] = m_lhom_y;
HomoLen[1] = m_lhom_z;
int nhom_modes_y = m_homogeneousBasis_y->GetNumModes();
int nhom_modes_z = m_homogeneousBasis_z->GetNumModes();
std::vector<unsigned int> yIDs;
std::vector<unsigned int> zIDs;
for(int n = 0; n < nhom_modes_z; ++n)
{
for(int m = 0; m < nhom_modes_y; ++m)
{
zIDs.push_back(n);
yIDs.push_back(m);
}
}
m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, 1, HomoBasis, HomoLen);
m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, 1, HomoBasis,
HomoLen, zIDs, yIDs);
return returnval;
}
......@@ -603,8 +619,24 @@ namespace Nektar
HomoLen[0] = m_lhom_y;
HomoLen[1] = m_lhom_z;
int nhom_modes_y = m_homogeneousBasis_y->GetNumModes();
int nhom_modes_z = m_homogeneousBasis_z->GetNumModes();
std::vector<unsigned int> yIDs;
std::vector<unsigned int> zIDs;
for(int n = 0; n < nhom_modes_z; ++n)
{
for(int m = 0; m < nhom_modes_y; ++m)
{
zIDs.push_back(n);
yIDs.push_back(m);
}
}
// enforce NumHomoDir == 1 by direct call
m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, 1, HomoBasis, HomoLen);
m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, 1, HomoBasis,
HomoLen, zIDs, yIDs);
}
void ExpListHomogeneous2D::v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs)
......@@ -683,6 +715,29 @@ namespace Nektar
}
}
}
void ExpListHomogeneous2D::v_WriteVtkPieceData(std::ostream &outfile, int expansion,
std::string var)
{
int i;
int nq = (*m_exp)[expansion]->GetTotPoints();
int npoints_per_line = m_lines[0]->GetTotPoints();
// printing the fields of that zone
outfile << " <DataArray type=\"Float32\" Name=\""
<< var << "\">" << endl;
outfile << " ";
for (int n = 0; n < m_lines.num_elements(); ++n)
{
const Array<OneD, NekDouble> phys = m_phys + m_phys_offset[expansion] + n*npoints_per_line;
for(i = 0; i < nq; ++i)
{
outfile << (fabs(phys[i]) < NekConstants::kNekZeroTol ? 0 : phys[i]) << " ";
}
}
outfile << endl;
outfile << " </DataArray>" << endl;
}
void ExpListHomogeneous2D::v_PhysDeriv(const Array<OneD, const NekDouble> &inarray,
Array<OneD, NekDouble> &out_d0,
......
......@@ -197,6 +197,9 @@ namespace Nektar
virtual void v_ExtractDataToCoeffs(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, std::string &field, Array<OneD, NekDouble> &coeffs);
virtual void v_WriteVtkPieceData(std::ostream &outfile, int expansion,
std::string var);
virtual void v_HomogeneousFwdTrans(const Array<OneD, const NekDouble> &inarray,
Array<OneD, NekDouble> &outarray,
CoeffState coeffstate = eLocal,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment