Commit 80e848ca authored by Dave Moxey's avatar Dave Moxey

Fixed Tecplot output for homogeneous fields, added XmlToVtk/XmlToTecplot...

Fixed Tecplot output for homogeneous fields, added XmlToVtk/XmlToTecplot functionality for homogeneous fields.
parent f5ae8a7f
......@@ -1329,6 +1329,15 @@ namespace Nektar
int coordim = GetExp(0)->GetCoordim();
char vars[3] = { 'x', 'y', 'z' };
if (m_expType == e3DH1D)
{
coordim += 1;
}
else if (m_expType == e3DH2D)
{
coordim += 2;
}
outfile << "Variables = x";
for (int i = 1; i < coordim; ++i)
{
......@@ -1397,10 +1406,24 @@ namespace Nektar
}
}
if (m_expType == e3DH1D)
{
nBases += 1;
coordim += 1;
int nPlanes = GetZIDs().num_elements();
NekDouble tmp = numBlocks * (nPlanes-1.0) / nPlanes;
numBlocks = (int)tmp;
}
else if (m_expType == e3DH2D)
{
nBases += 2;
coordim += 1;
}
outfile << "Zone, N=" << nPoints << ", E="
<< numBlocks << ", F=FEBlock" ;
switch((*m_exp)[0]->GetNumBases())
switch(nBases)
{
case 2:
outfile << ", ET=QUADRILATERAL" << std::endl;
......
......@@ -279,45 +279,46 @@ namespace Nektar
}
}
/**
* Write Tecplot Files Zone
* @param outfile Output file name.
* @param expansion Expansion that is considered
*/
void ExpList3DHomogeneous1D::v_WriteTecplotZone(std::ofstream &outfile, int expansion)
void ExpList3DHomogeneous1D::v_WriteTecplotConnectivity(std::ofstream &outfile, int expansion)
{
ExpList::v_WriteTecplotZone(outfile, expansion);
/*
int i,j;
int nquad0 = (*m_exp)[expansion]->GetNumPoints(0);
int nquad1 = (*m_exp)[expansion]->GetNumPoints(1);
int nquad2 = m_planes.num_elements();
ASSERTL0(expansion == -1, "Multi-zone output not supported for homogeneous expansions.");
Array<OneD,NekDouble> coords[3];
const int nPtsPlane = m_planes[0]->GetNpoints();
const int nElmt = m_planes[0]->GetExpSize();
const int nPlanes = m_planes.num_elements();
coords[0] = Array<OneD,NekDouble>(3*nquad0*nquad1*nquad2);
coords[1] = coords[0] + nquad0*nquad1*nquad2;
coords[2] = coords[1] + nquad0*nquad1*nquad2;
GetCoords(expansion,coords[0],coords[1],coords[2]);
outfile << "Zone, I=" << nquad0 << ", J=" << nquad1 <<",K="
<< nquad2 << ", F=Block" << std::endl;
for(j = 0; j < 3; ++j)
int cnt = 0;
int cnt2 = 0;
for (int i = 0; i < nElmt; ++i)
{
for(i = 0; i < nquad0*nquad1*nquad2; ++i)
const int np0 = (*m_exp)[i]->GetNumPoints(0);
const int np1 = (*m_exp)[i]->GetNumPoints(1);
for (int n = 1; n < nPlanes; ++n)
{
outfile << coords[j][i] << " ";
const int o1 = (n-1) * nPtsPlane;
const int o2 = n * nPtsPlane;
for (int j = 1; j < np1; ++j)
{
for(int k = 1; k < np0; ++k)
{
outfile << cnt + (j-1)*np0 + (k-1) + o1 + 1 << " ";
outfile << cnt + (j-1)*np0 + (k-1) + o2 + 1 << " ";
outfile << cnt + (j-1)*np0 + k + o2 + 1 << " ";
outfile << cnt + (j-1)*np0 + k + o1 + 1 << " ";
outfile << cnt + j *np0 + (k-1) + o1 + 1 << " ";
outfile << cnt + j *np0 + (k-1) + o2 + 1 << " ";
outfile << cnt + j *np0 + k + o2 + 1 << " ";
outfile << cnt + j *np0 + k + o1 + 1 << endl;
cnt2++;
}
}
}
outfile << std::endl;
cnt += np0*np1;
}
*/
}
void ExpList3DHomogeneous1D::v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion)
{
int i,j,k;
......
......@@ -121,9 +121,7 @@ namespace Nektar
Array<OneD, NekDouble> &coord_1,
Array<OneD, NekDouble> &coord_2);
virtual void v_WriteTecplotZone(std::ofstream &outfile,
int expansion);
virtual void v_WriteTecplotConnectivity(std::ofstream &outfile, int expansion);
virtual void v_WriteVtkPieceHeader(std::ofstream &outfile, int expansion);
......
// Wrapper function around FldToTecGmsh2D.cpp with TECPLOT undefined
#include "FldToTecGmsh.cpp"
This diff is collapsed.
......@@ -74,8 +74,7 @@ int main(int argc, char *argv[])
bool HalfModePlot=false;
int nExtraPoints, nExtraPlanes;
LibUtilities::SessionReader::RegisterCmdLineFlag(
"multi-zone", "m", "Output multi-zone format (one element per zone).");
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
......@@ -529,8 +528,8 @@ int main(int argc, char *argv[])
Exp1[0]->WriteTecplotConnectivity(outfile,i);
}
}
else{
else
{
std::string var = "";
for(int j = 0; j < Exp.num_elements(); ++j)
......@@ -539,29 +538,13 @@ int main(int argc, char *argv[])
}
ofstream outfile(fname.c_str());
Exp[0]->WriteTecplotHeader(outfile,var);
if (vSession->DefinesCmdLineArgument("multi-zone"))
{
for(int i = 0; i < Exp[0]->GetNumElmts(); ++i)
{
Exp[0]->WriteTecplotZone(outfile,i);
for(int j = 0; j < Exp.num_elements(); ++j)
{
Exp[j]->WriteTecplotField(outfile,i);
}
Exp[0]->WriteTecplotConnectivity(outfile,i);
}
}
else
Exp[0]->WriteTecplotHeader(outfile, var);
Exp[0]->WriteTecplotZone(outfile);
for(int j = 0; j < Exp.num_elements(); ++j)
{
Exp[0]->WriteTecplotZone(outfile);
for(int j = 0; j < Exp.num_elements(); ++j)
{
Exp[j]->WriteTecplotField(outfile);
}
Exp[0]->WriteTecplotConnectivity(outfile);
Exp[j]->WriteTecplotField(outfile);
}
Exp[0]->WriteTecplotConnectivity(outfile);
}
//----------------------------------------------
}
......
......@@ -40,6 +40,7 @@
#include <MultiRegions/ExpList1D.h>
#include <MultiRegions/ExpList2D.h>
#include <MultiRegions/ExpList3D.h>
#include <MultiRegions/ExpList3DHomogeneous1D.h>
using namespace Nektar;
......@@ -102,9 +103,38 @@ int main(int argc, char *argv[])
}
case 2:
{
MultiRegions::ExpList2DSharedPtr Exp2D;
Exp2D = MemoryManager<MultiRegions::ExpList2D>::AllocateSharedPtr(vSession,graphShPt);
Exp[0] = Exp2D;
if(vSession->DefinesSolverInfo("HOMOGENEOUS"))
{
std::string HomoStr = vSession->GetSolverInfo("HOMOGENEOUS");
MultiRegions::ExpList3DHomogeneous1DSharedPtr Exp3DH1;
ASSERTL0(
HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
HomoStr == "1D" || HomoStr == "Homo1D",
"Only 3DH1D supported for XML output currently.");
int nplanes;
vSession->LoadParameter("HomModesZ", nplanes);
// choose points to be at evenly spaced points at nplanes + 1
// points
const LibUtilities::PointsKey Pkey(
nplanes + 1, LibUtilities::ePolyEvenlySpaced);
const LibUtilities::BasisKey Bkey(
LibUtilities::eFourier, nplanes, Pkey);
NekDouble lz = vSession->GetParameter("LZ");
Exp3DH1 = MemoryManager<MultiRegions::ExpList3DHomogeneous1D>
::AllocateSharedPtr(
vSession, Bkey, lz, false, false, graphShPt);
Exp[0] = Exp3DH1;
}
else
{
MultiRegions::ExpList2DSharedPtr Exp2D;
Exp2D = MemoryManager<MultiRegions::ExpList2D>::AllocateSharedPtr(vSession,graphShPt);
Exp[0] = Exp2D;
}
break;
}
case 3:
......
......@@ -5,6 +5,7 @@
#include <MultiRegions/ExpList1D.h>
#include <MultiRegions/ExpList2D.h>
#include <MultiRegions/ExpList3D.h>
#include <MultiRegions/ExpList3DHomogeneous1D.h>
using namespace Nektar;
......@@ -62,10 +63,39 @@ int main(int argc, char *argv[])
}
case 2:
{
MultiRegions::ExpList2DSharedPtr Exp2D;
Exp2D = MemoryManager<MultiRegions::ExpList2D>
::AllocateSharedPtr(vSession,graphShPt);
Exp[0] = Exp2D;
if(vSession->DefinesSolverInfo("HOMOGENEOUS"))
{
std::string HomoStr = vSession->GetSolverInfo("HOMOGENEOUS");
MultiRegions::ExpList3DHomogeneous1DSharedPtr Exp3DH1;
ASSERTL0(
HomoStr == "HOMOGENEOUS1D" || HomoStr == "Homogeneous1D" ||
HomoStr == "1D" || HomoStr == "Homo1D",
"Only 3DH1D supported for XML output currently.");
int nplanes;
vSession->LoadParameter("HomModesZ", nplanes);
// choose points to be at evenly spaced points at nplanes + 1
// points
const LibUtilities::PointsKey Pkey(
nplanes + 1, LibUtilities::ePolyEvenlySpaced);
const LibUtilities::BasisKey Bkey(
LibUtilities::eFourier, nplanes, Pkey);
NekDouble lz = vSession->GetParameter("LZ");
Exp3DH1 = MemoryManager<MultiRegions::ExpList3DHomogeneous1D>
::AllocateSharedPtr(
vSession, Bkey, lz, false, false, graphShPt);
Exp[0] = Exp3DH1;
}
else
{
MultiRegions::ExpList2DSharedPtr Exp2D;
Exp2D = MemoryManager<MultiRegions::ExpList2D>
::AllocateSharedPtr(vSession,graphShPt);
Exp[0] = Exp2D;
}
break;
}
case 3:
......
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