Commit fa5c0d20 authored by Spencer Sherwin's avatar Spencer Sherwin
Browse files

Added the ability to specify additional physical space output points


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@3347 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 1bdd9afa
......@@ -19,7 +19,7 @@ int main(int argc, char *argv[])
if(argc != 3)
{
fprintf(stderr,"Usage: FldToVtk meshfile fieldfile\n");
fprintf(stderr,"Usage: FldAddField meshfile fieldfile\n");
exit(1);
}
......@@ -75,7 +75,7 @@ int main(int argc, char *argv[])
Exp[i] = MemoryManager<MultiRegions::ExpList2DHomogeneous1D>::AllocateSharedPtr(*Exp2DH1);
}
}
else if(fielddef[0]->m_numHomogeneousDir == 2)
else if(fielddef[0]->m_numHomogeneousDir == 2)
{
MultiRegions::ExpList3DHomogeneous2DSharedPtr Exp3DH2;
......@@ -191,7 +191,7 @@ int main(int argc, char *argv[])
//----------------------------------------------
// Compute gradients of fields and compute reentricity
ASSERTL0(nfields == 2, "Need two fields (u,v) to add reentricity");
ASSERTL0(nfields >= 2, "Need two fields (u,v) to add reentricity");
int nq = Exp[0]->GetNpoints();
Array<OneD, NekDouble> grad_u[2], grad_v[2];
Array<OneD, NekDouble> mag_cross(nq);
......
......@@ -29,9 +29,13 @@ int main(int argc, char *argv[])
exit(1);
}
int nExtraPoints;
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
vSession->LoadParameter("OutputExtraPoints",nExtraPoints,0);
// Read in mesh from input file
string meshfile(argv[argc-2]);
SpatialDomains::MeshGraphSharedPtr graphShPt = SpatialDomains::MeshGraph::Read(meshfile);
......@@ -47,18 +51,39 @@ int main(int argc, char *argv[])
//----------------------------------------------
// Set up Expansion information
vector< vector<LibUtilities::PointsType> > pointstype;
for(i = 0; i < fielddef.size(); ++i)
{
vector<LibUtilities::PointsType> ptype;
for(j = 0; j < 2; ++j)
for(j = 0; j < 3; ++j)
{
ptype.push_back(LibUtilities::ePolyEvenlySpaced);
}
pointstype.push_back(ptype);
fielddef[i]->m_pointsDef = true;
fielddef[i]->m_points = ptype;
vector<unsigned int> porder;
if(fielddef[i]->m_numPointsDef == false)
{
for(j = 0; j < fielddef[i]->m_numModes.size(); ++j)
{
porder.push_back(fielddef[i]->m_numModes[j]+nExtraPoints);
}
fielddef[i]->m_numPointsDef = true;
}
else
{
for(j = 0; j < fielddef[i]->m_numPoints.size(); ++j)
{
porder.push_back(fielddef[i]->m_numPoints[j]+nExtraPoints);
}
}
fielddef[i]->m_numPoints = porder;
}
graphShPt->SetExpansions(fielddef,pointstype);
bool useFFT = false;
graphShPt->SetExpansions(fielddef);
bool useFFT = false;
//----------------------------------------------
......@@ -196,7 +221,8 @@ int main(int argc, char *argv[])
{
for(int i = 0; i < fielddata.size(); ++i)
{
Exp[j]->ExtractDataToCoeffs(fielddef[i],fielddata[i],fielddef[i]->m_fields[j]);
Exp[j]->ExtractDataToCoeffs(fielddef[i],fielddata[i],
fielddef[i]->m_fields[j]);
}
Exp[j]->BwdTrans(Exp[j]->GetCoeffs(),Exp[j]->UpdatePhys());
}
......@@ -210,13 +236,13 @@ int main(int argc, char *argv[])
for(int j = 0; j < Exp.num_elements(); ++j)
{
var = var + ", " + fielddef[0]->m_fields[j];
}
}
string outname(strtok(argv[argc-1],"."));
outname += ".dat";
ofstream outfile(outname.c_str());
cout << "Writing file: " << outname << " ... ";
Exp[0]->WriteTecplotHeader(outfile,var);
for(int i = 0; i < Exp[0]->GetNumElmts(); ++i)
{
......
......@@ -31,9 +31,13 @@ int main(int argc, char *argv[])
exit(1);
}
int nExtraPoints;
LibUtilities::SessionReaderSharedPtr vSession
= LibUtilities::SessionReader::CreateInstance(argc, argv);
vSession->LoadParameter("OutputExtraPoints",nExtraPoints,0);
//----------------------------------------------
// Read in mesh from input file
SpatialDomains::MeshGraphSharedPtr graphShPt = SpatialDomains::MeshGraph::Read(vSession->GetFilename(), false);
......@@ -69,12 +73,11 @@ int main(int argc, char *argv[])
vector<SpatialDomains::FieldDefinitionsSharedPtr> fielddef;
vector<vector<NekDouble> > fielddata;
graphShPt->Import(fieldfile,fielddef,fielddata);
bool useFFT = false;
bool useFFT = false;
//----------------------------------------------
//----------------------------------------------
// Set up Expansion information
vector< vector<LibUtilities::PointsType> > pointstype;
for(i = 0; i < fielddef.size(); ++i)
{
vector<LibUtilities::PointsType> ptype;
......@@ -82,9 +85,31 @@ int main(int argc, char *argv[])
{
ptype.push_back(LibUtilities::ePolyEvenlySpaced);
}
pointstype.push_back(ptype);
fielddef[i]->m_pointsDef = true;
fielddef[i]->m_points = ptype;
vector<unsigned int> porder;
if(fielddef[i]->m_numPointsDef == false)
{
for(j = 0; j < fielddef[i]->m_numModes.size(); ++j)
{
porder.push_back(fielddef[i]->m_numModes[j]+nExtraPoints);
}
fielddef[i]->m_numPointsDef = true;
}
else
{
for(j = 0; j < fielddef[i]->m_numPoints.size(); ++j)
{
porder.push_back(fielddef[i]->m_numPoints[j]+nExtraPoints);
}
}
fielddef[i]->m_numPoints = porder;
}
graphShPt->SetExpansions(fielddef,pointstype);
graphShPt->SetExpansions(fielddef);
//----------------------------------------------
......
Supports Markdown
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