Commit 83224ffa authored by Chris Cantwell's avatar Chris Cantwell

Merge branch 'feature/extrafields' of /opt/gitlab/repositories/nektar

parents de6bf027 feccf896
......@@ -198,12 +198,12 @@ namespace Nektar
}
};
void DriverArnoldi::WriteFld(std::string file, Array<OneD, Array<OneD, NekDouble> > coeffs)
void DriverArnoldi::WriteFld(std::string file, std::vector<Array<OneD, NekDouble> > coeffs)
{
Array<OneD, std::string> variables(m_nfields);
std::vector<std::string> variables(m_nfields);
ASSERTL1(coeffs.num_elements() >= m_nfields, "coeffs is not of the correct length");
ASSERTL1(coeffs.size() >= m_nfields, "coeffs is not of the correct length");
for(int i = 0; i < m_nfields; ++i)
{
variables[i] = m_equ[0]->GetVariable(i);
......@@ -216,8 +216,8 @@ namespace Nektar
void DriverArnoldi::WriteFld(std::string file, Array<OneD, NekDouble> coeffs)
{
Array<OneD, std::string> variables(m_nfields);
Array<OneD, Array<OneD, NekDouble> > fieldcoeffs(m_nfields);
std::vector<std::string> variables(m_nfields);
std::vector<Array<OneD, NekDouble> > fieldcoeffs(m_nfields);
int ncoeffs = m_equ[0]->UpdateFields()[0]->GetNcoeffs();
ASSERTL1(coeffs.num_elements() >= ncoeffs*m_nfields,"coeffs is not of sufficient size");
......
......@@ -84,7 +84,7 @@ namespace Nektar
void CopyFwdToAdj();
// write coefficients to file.
void WriteFld(std::string file, Array<OneD, Array<OneD, NekDouble> > coeffs);
void WriteFld(std::string file, std::vector<Array<OneD, NekDouble> > coeffs);
void WriteFld(std::string file, Array<OneD, NekDouble> coeffs);
......
......@@ -1864,8 +1864,8 @@ namespace Nektar
void EquationSystem::Checkpoint_Output(
const int n,
MultiRegions::ExpListSharedPtr &field,
Array< OneD, Array<OneD, NekDouble> > &fieldcoeffs,
Array<OneD, std::string> &variables)
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
{
char chkout[16] = "";
sprintf(chkout, "%d", n);
......@@ -1873,19 +1873,15 @@ namespace Nektar
WriteFld(outname, field, fieldcoeffs, variables);
}
/**
* Writes the field data to a file with the given filename.
* @param outname Filename to write to.
*/
void EquationSystem::WriteFld(const std::string &outname)
{
Array<OneD, Array<OneD, NekDouble> > fieldcoeffs
(m_fields.num_elements());
Array<OneD, std::string> variables(m_fields.num_elements());
std::vector<Array<OneD, NekDouble> > fieldcoeffs(
m_fields.num_elements());
std::vector<std::string> variables(m_fields.num_elements());
for (int i = 0; i < m_fields.num_elements(); ++i)
{
......@@ -1904,8 +1900,9 @@ namespace Nektar
variables[i] = m_boundaryConditions->GetVariable(i);
}
WriteFld(outname, m_fields[0], fieldcoeffs, variables);
v_ExtraFldOutput(fieldcoeffs, variables);
WriteFld(outname, m_fields[0], fieldcoeffs, variables);
}
......@@ -1918,17 +1915,17 @@ namespace Nektar
* @param variables An array of variable names.
*/
void EquationSystem::WriteFld(
const std::string &outname,
MultiRegions::ExpListSharedPtr &field,
Array<OneD, Array<OneD, NekDouble> > &fieldcoeffs,
Array<OneD, std::string> &variables)
const std::string &outname,
MultiRegions::ExpListSharedPtr &field,
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
{
std::vector<LibUtilities::FieldDefinitionsSharedPtr> FieldDef
= field->GetFieldDefinitions();
std::vector<std::vector<NekDouble> > FieldData(FieldDef.size());
// Copy Data into FieldData and set variable
for(int j = 0; j < fieldcoeffs.num_elements(); ++j)
for(int j = 0; j < fieldcoeffs.size(); ++j)
{
for(int i = 0; i < FieldDef.size(); ++i)
{
......@@ -2291,5 +2288,11 @@ namespace Nektar
MultiRegions::ExpListSharedPtr null;
return null;
}
void EquationSystem::v_ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables)
{
}
}
}
......@@ -239,8 +239,8 @@ namespace Nektar
SOLVER_UTILS_EXPORT void Checkpoint_Output(
const int n,
MultiRegions::ExpListSharedPtr &field,
Array< OneD, Array<OneD, NekDouble> > &fieldcoeffs,
Array<OneD, std::string> &variables);
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables);
/// Write field data to the given filename.
SOLVER_UTILS_EXPORT void WriteFld(const std::string &outname);
......@@ -249,8 +249,8 @@ namespace Nektar
SOLVER_UTILS_EXPORT void WriteFld(
const std::string &outname,
MultiRegions::ExpListSharedPtr &field,
Array<OneD, Array<OneD, NekDouble> > &fieldcoeffs,
Array<OneD, std::string> &variables);
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables);
/// Input field data from the given file.
SOLVER_UTILS_EXPORT void ImportFld(
......@@ -456,7 +456,7 @@ namespace Nektar
Array<OneD, bool> m_checkIfSystemSingular;
/// Map to identify relevant solver info to dump in output fields
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap;
LibUtilities::FieldMetaDataMap m_fieldMetaDataMap;
/// Number of Quadrature points used to work out the error
int m_NumQuadPointsError;
......@@ -550,6 +550,10 @@ namespace Nektar
// Get pressure field if available
SOLVER_UTILS_EXPORT virtual MultiRegions::ExpListSharedPtr v_GetPressure(void);
SOLVER_UTILS_EXPORT virtual void v_ExtraFldOutput(
std::vector<Array<OneD, NekDouble> > &fieldcoeffs,
std::vector<std::string> &variables);
private:
......
......@@ -2162,8 +2162,8 @@ namespace Nektar
void CoupledLinearNS::v_Output(void)
{
Array<OneD, Array<OneD, NekDouble > > fieldcoeffs(m_fields.num_elements()+1);
Array<OneD, std::string> variables(m_fields.num_elements()+1);
std::vector<Array<OneD, NekDouble> > fieldcoeffs(m_fields.num_elements()+1);
std::vector<std::string> variables(m_fields.num_elements()+1);
int i;
for(i = 0; i < m_fields.num_elements(); ++i)
......
......@@ -443,9 +443,9 @@ namespace Nektar
// Write out data into base flow with variable Vx,Vy
cout << "Writing data to session-Base.fld" << endl;
Array<OneD, std::string> variables(2);
std::vector<std::string> variables(2);
variables[0] = "Vx"; variables[1] = "Vy";
Array<OneD, Array<OneD, NekDouble> > outfield(2);
std::vector<Array<OneD, NekDouble> > outfield(2);
outfield[0] = m_solverRoll->UpdateFields()[0]->UpdateCoeffs();
outfield[1] = m_solverRoll->UpdateFields()[1]->UpdateCoeffs();
std::string outname = m_sessionName + "-Base.fld";
......@@ -720,8 +720,8 @@ namespace Nektar
// dump field
{
Array<OneD, std::string> variables(3);
Array<OneD, Array<OneD, NekDouble> > outfield(3);
std::vector<std::string> variables(3);
std::vector<Array<OneD, NekDouble> > outfield(3);
variables[0] = "u_w";
variables[1] = "v_w";
variables[2] = "w_w";
......@@ -930,8 +930,8 @@ namespace Nektar
// dump output
Array<OneD, std::string> variables(4);
Array<OneD, Array<OneD, NekDouble> > outfield(4);
std::vector<std::string> variables(4);
std::vector<Array<OneD, NekDouble> > outfield(4);
variables[0] = "u"; variables[1] = "v";
variables[2] = "pr"; variables[3] = "pi";
outfield[0] = m_vwiForcing[0];
......
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