Commit 130f6ce2 authored by Chris Cantwell's avatar Chris Cantwell

Merge branch 'master' into feature/AvgFilterMultiOutput

parents 857d9c4a e9f4ab02
......@@ -445,10 +445,10 @@ namespace Nektar
for(i = 0; i < ElementIDs.num_elements(); ++i)
{
ASSERTL1(FileIDs.count(ElementIDs[i]) != 0,
"ElementIDs not found in partitions");
LoadFile.insert(FileIDs[ElementIDs[i]]);
if(FileIDs.count(ElementIDs[i]))
{
LoadFile.insert(FileIDs[ElementIDs[i]]);
}
}
set<int>::iterator iter;
......@@ -518,20 +518,19 @@ namespace Nektar
for (int t = 0; t < fileNames.size(); ++t)
{
if(elementList[t].size())
{
TiXmlElement * elemIDs = new TiXmlElement("Partition");
root->LinkEndChild(elemIDs);
elemIDs->SetAttribute("FileName",fileNames[t]);
string IDstring;
GenerateSeqString(elementList[t],IDstring);
ASSERTL1(elementList[t].size() > 0,
"Element list must contain at least one value.");
TiXmlElement * elemIDs = new TiXmlElement("Partition");
root->LinkEndChild(elemIDs);
elemIDs->SetAttribute("FileName",fileNames[t]);
string IDstring;
GenerateSeqString(elementList[t],IDstring);
elemIDs->LinkEndChild(new TiXmlText(IDstring));
elemIDs->LinkEndChild(new TiXmlText(IDstring));
}
}
doc.SaveFile(outFile);
......@@ -1329,7 +1328,12 @@ namespace Nektar
int FieldIO::CheckFieldDefinition(const FieldDefinitionsSharedPtr &fielddefs)
{
int i;
ASSERTL0(fielddefs->m_elementIDs.size() > 0, "Fielddefs vector must contain at least one element of data .");
if(fielddefs->m_elementIDs.size() == 0) // empty partition
{
return 0;
}
//ASSERTL0(fielddefs->m_elementIDs.size() > 0, "Fielddefs vector must contain at least one element of data .");
unsigned int numbasis = 0;
......
......@@ -1589,11 +1589,13 @@ namespace Nektar
RT.SetValue(i, i, 1.0);
}
if (matrixType == StdRegions::ePreconR)
if ((matrixType == StdRegions::ePreconR)||
(matrixType == StdRegions::ePreconRMass))
{
return m_transformationmatrix;
}
else if (matrixType == StdRegions::ePreconRT)
else if ((matrixType == StdRegions::ePreconRT)||
(matrixType == StdRegions::ePreconRTMass))
{
return m_transposedtransformationmatrix;
}
......
......@@ -1730,6 +1730,17 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
......@@ -1756,6 +1767,32 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr RT=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
default:
{
NekDouble one = 1.0;
......
......@@ -1473,16 +1473,24 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
MatrixKey helmkey(StdRegions::eHelmholtz, mkey.GetShapeType(), *this,mkey.GetConstFactors(), mkey.GetVarCoeffs());
DNekScalBlkMatSharedPtr helmStatCond = GetLocStaticCondMatrix(helmkey);
DNekScalMatSharedPtr A =helmStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Blk01 =helmStatCond->GetBlock(0,1);
DNekScalMatSharedPtr Blk10 =helmStatCond->GetBlock(1,0);
DNekScalMatSharedPtr Blk11 =helmStatCond->GetBlock(1,1);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
......@@ -1495,9 +1503,32 @@ namespace Nektar
MatrixKey helmkey(StdRegions::eHelmholtz, mkey.GetShapeType(), *this,mkey.GetConstFactors(), mkey.GetVarCoeffs());
DNekScalBlkMatSharedPtr helmStatCond = GetLocStaticCondMatrix(helmkey);
DNekScalMatSharedPtr A =helmStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Blk01 =helmStatCond->GetBlock(0,1);
DNekScalMatSharedPtr Blk10 =helmStatCond->GetBlock(1,0);
DNekScalMatSharedPtr Blk11 =helmStatCond->GetBlock(1,1);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
......
......@@ -1232,6 +1232,17 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconLinearSpaceMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekMatSharedPtr R=BuildVertexMatrix(A);
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconR:
{
NekDouble one = 1.0;
......@@ -1258,6 +1269,32 @@ namespace Nektar
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
case StdRegions::ePreconRMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr StatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =StatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr R=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,R);
}
break;
case StdRegions::ePreconRTMass:
{
NekDouble one = 1.0;
MatrixKey masskey(StdRegions::eMass, mkey.GetShapeType(), *this);
DNekScalBlkMatSharedPtr massStatCond = GetLocStaticCondMatrix(masskey);
DNekScalMatSharedPtr A =massStatCond->GetBlock(0,0);
DNekScalMatSharedPtr Atmp;
DNekMatSharedPtr RT=BuildTransformationMatrix(A,mkey.GetMatrixType());
returnval = MemoryManager<DNekScalMat>::AllocateSharedPtr(one,RT);
}
break;
default:
{
//ASSERTL0(false, "Missing definition for " + (*StdRegions::MatrixTypeMap[mkey.GetMatrixType()]));
......
......@@ -126,8 +126,6 @@ namespace Nektar
boost::bind(&ContField2D::GenGlobalLinSys, this, _1),
std::string("GlobalLinSys"))
{
SpatialDomains::BoundaryConditions bcs(m_session, graph2D);
m_locToGloMap = MemoryManager<AssemblyMapCG2D>
::AllocateSharedPtr(m_session,m_ncoeffs,*this,
m_bndCondExpansions,
......@@ -174,7 +172,6 @@ namespace Nektar
boost::bind(&ContField2D::GenGlobalLinSys, this, _1),
std::string("GlobalLinSys"))
{
SpatialDomains::BoundaryConditions bcs(m_session, graph2D);
if(!SameTypeOfBoundaryConditions(In) || CheckIfSingularSystem)
{
m_locToGloMap = MemoryManager<AssemblyMapCG2D>
......
......@@ -64,7 +64,7 @@ namespace Nektar
MULTI_REGIONS_EXPORT ContField2D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const std::string &variable = "DefaultVar",
const bool DeclareCoeffPhysArrays = true,
const bool CheckIfSingularSystem = false);
......
......@@ -83,8 +83,6 @@ namespace Nektar
boost::bind(&ContField3D::GenGlobalLinSys, this, _1),
std::string("GlobalLinSys"))
{
SpatialDomains::BoundaryConditions bcs(m_session, graph3D);
m_locToGloMap = MemoryManager<AssemblyMapCG3D>::AllocateSharedPtr(
m_session,m_ncoeffs,*this,m_bndCondExpansions,m_bndConditions,
m_periodicVerts, m_periodicEdges, m_periodicFaces,
......
......@@ -57,7 +57,7 @@ namespace Nektar
MULTI_REGIONS_EXPORT ContField3D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string &variable,
const std::string &variable = "DefaultVar",
const bool CheckIfSingularSystem = false);
/// Construct a global continuous field with solution type based on
......
......@@ -95,20 +95,21 @@ namespace Nektar
m_periodicFwdCopy(),
m_periodicBwdCopy()
{
SpatialDomains::BoundaryConditions bcs(m_session, graph2D);
GenerateBoundaryConditionExpansion(graph2D,bcs,variable,
DeclareCoeffPhysArrays);
if (DeclareCoeffPhysArrays)
if(variable.compare("DefaultVar") != 0) // do not set up BCs if default variable
{
EvaluateBoundaryConditions(0.0, variable);
}
SpatialDomains::BoundaryConditions bcs(m_session, graph2D);
GenerateBoundaryConditionExpansion(graph2D,bcs,variable,
DeclareCoeffPhysArrays);
if (DeclareCoeffPhysArrays)
{
EvaluateBoundaryConditions(0.0, variable);
}
ApplyGeomInfo();
// Find periodic edges for this variable.
FindPeriodicEdges(bcs, variable);
// Find periodic edges for this variable.
FindPeriodicEdges(bcs, variable);
}
if (SetUpJustDG)
{
......
......@@ -81,18 +81,20 @@
m_bndConditions (),
m_trace(NullExpListSharedPtr)
{
SpatialDomains::BoundaryConditions bcs(m_session, graph3D);
GenerateBoundaryConditionExpansion(graph3D,bcs,variable);
EvaluateBoundaryConditions(0.0, variable);
ApplyGeomInfo();
// Find periodic edges for this variable.
FindPeriodicFaces(bcs, variable);
if(variable.compare("DefaultVar") != 0) // do not set up BCs if default variable
{
SpatialDomains::BoundaryConditions bcs(m_session, graph3D);
GenerateBoundaryConditionExpansion(graph3D,bcs,variable);
EvaluateBoundaryConditions(0.0, variable);
if(SetUpJustDG)
{
SetUpDG();
// Find periodic edges for this variable.
FindPeriodicFaces(bcs, variable);
}
if(SetUpJustDG)
{
SetUpDG();
}
else
{
......
......@@ -205,7 +205,8 @@ namespace Nektar
// and the number of matrix entries for each block
// Dimension of matrix is just the linear vertex space
if(m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpace)
if((m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpace)
||(m_linSysKey.GetMatrixType() == StdRegions::ePreconLinearSpaceMass))
{
for (n = 0; n < nElmt; ++n)
{
......
......@@ -87,12 +87,24 @@ namespace Nektar
m_vertLocToGloMap = m_locToGloMap->XxtLinearSpaceMap(*expList);
// Generate XXT system.
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpace,
m_vertLocToGloMap,
(m_linsys.lock())->GetKey().GetConstFactors());
if(m_linsys.lock()->GetKey().GetMatrixType() == StdRegions::eMass)
{
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpaceMass,
m_vertLocToGloMap);
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
else
{
GlobalLinSysKey preconKey(StdRegions::ePreconLinearSpace,
m_vertLocToGloMap,
(m_linsys.lock())->GetKey().GetConstFactors());
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
m_vertLinsys = MemoryManager<GlobalLinSysXxtFull>::
AllocateSharedPtr(preconKey,expList,m_vertLocToGloMap);
}
......
......@@ -1704,58 +1704,62 @@ namespace Nektar
}
}
StdRegions::MatrixType PreconR,PreconRT;
if(m_linSysKey.GetMatrixType() == StdRegions::eMass)
{
PreconR = StdRegions::ePreconRMass;
PreconRT = StdRegions::ePreconRTMass;
}
else
{
PreconR = StdRegions::ePreconR;
PreconRT = StdRegions::ePreconRT;
}
/*
* Matrix keys - for each element type there are two matrix keys
* corresponding to the transformation matrix R and its transpose
*/
//Matrix keys for tetrahedral element transformation matrix
LocalRegions::MatrixKey TetR
(StdRegions::ePreconR,
LibUtilities::eTetrahedron,
*TetExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::eTetrahedron,
*TetExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for tetrahedral transposed transformation matrix
LocalRegions::MatrixKey TetRT
(StdRegions::ePreconRT,
LibUtilities::eTetrahedron,
*TetExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::eTetrahedron,
*TetExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for prismatic element transformation matrix
LocalRegions::MatrixKey PrismR
(StdRegions::ePreconR,
LibUtilities::ePrism,
*PrismExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::ePrism,
*PrismExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for prismatic element transposed transformation matrix
LocalRegions::MatrixKey PrismRT
(StdRegions::ePreconRT,
LibUtilities::ePrism,
*PrismExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::ePrism,
*PrismExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for hexahedral element transformation matrix
LocalRegions::MatrixKey HexR
(StdRegions::ePreconR,
LibUtilities::eHexahedron,
*HexExp,
m_linSysKey.GetConstFactors(),
(PreconR, LibUtilities::eHexahedron,
*HexExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
//Matrix keys for hexahedral element transposed transformation
//matrix
LocalRegions::MatrixKey HexRT
(StdRegions::ePreconRT,
LibUtilities::eHexahedron,
*HexExp,
m_linSysKey.GetConstFactors(),
(PreconRT, LibUtilities::eHexahedron,
*HexExp, m_linSysKey.GetConstFactors(),
vVarCoeffMap);
/*
......
......@@ -1643,24 +1643,25 @@ namespace Nektar
{
m_expansionMapShPtrMap["DefaultVar"] = expansionMap;
}
}
// loop over all elements in partition and set expansion
expansionMap = m_expansionMapShPtrMap.find(field)->second;
LibUtilities::BasisKeyVector def;
CompositeMap::const_iterator compIter;
for (compIter = m_domain.begin(); compIter != m_domain.end(); ++compIter)
{
GeometryVector::const_iterator x;
for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
// loop over all elements in partition and set expansion
expansionMap = m_expansionMapShPtrMap.find(field)->second;
LibUtilities::BasisKeyVector def;
CompositeMap::const_iterator compIter;
for (compIter = m_domain.begin(); compIter != m_domain.end(); ++compIter)
{
ExpansionShPtr expansionElementShPtr =
MemoryManager<Expansion>::AllocateSharedPtr(*x, def);
int id = (*x)->GetGlobalID();
(*expansionMap)[id] = expansionElementShPtr;
GeometryVector::const_iterator x;
for (x = compIter->second->begin(); x != compIter->second->end(); ++x)
{
ExpansionShPtr expansionElementShPtr =
MemoryManager<Expansion>::AllocateSharedPtr(*x, def);
int id = (*x)->GetGlobalID();
(*expansionMap)[id] = expansionElementShPtr;
}
}
}
}
......
......@@ -138,7 +138,10 @@ namespace Nektar
eFwdTrans,
ePreconR,
ePreconRT,
ePreconRMass,
ePreconRTMass,
ePreconLinearSpace,
ePreconLinearSpaceMass,
eInterpGauss,
eGaussDG,
SIZE_MatrixType
......
......@@ -7,7 +7,10 @@ SET(FieldConvertHeaders
OutputVtk.h
OutputFld.h
ProcessBoundaryExtract.h
ProcessConcatenateFld.h
ProcessInterpField.h
ProcessVorticity.h
ProcessC0Projection.h
ProcessQCriterion.h
)
......@@ -20,7 +23,10 @@ SET(FieldConvertSources
OutputVtk.cpp
OutputFld.cpp
ProcessBoundaryExtract.cpp
ProcessConcatenateFld.cpp
ProcessInterpField.cpp
ProcessVorticity.cpp
ProcessC0Projection.cpp
ProcessQCriterion.cpp
)
......
......@@ -146,6 +146,9 @@ namespace Nektar
ElementGIDs[i++] = expIt->second->m_geomShPtr->GetGlobalID();
}
m_f->m_fielddef.clear();
m_f->m_data.clear();
m_f->m_fld->Import(m_f->m_inputfiles[fldending][0],m_f->m_fielddef,m_f->m_data,
LibUtilities::NullFieldMetaDataMap,
ElementGIDs);
......@@ -177,11 +180,19 @@ namespace Nektar
{
if(i < vars.size())
{
m_f->m_exp[i] = m_f->AppendExpList(vars[i]);
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir,
vars[i]);
}
else
{
m_f->m_exp[i] = m_f->AppendExpList();
if(vars.size())
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir,vars[0]);
}
else
{
m_f->m_exp[i] = m_f->AppendExpList(m_f->m_fielddef[0]->m_numHomogeneousDir);
}
}
}
......
......@@ -83,7 +83,6 @@ namespace Nektar
cout << "OutputFld: Writing boundary file(s): ";
for(int i = 0; i < m_f->m_bndRegionsToWrite.size(); ++i)
{
cout << m_f->m_bndRegionsToWrite[i];
if(i < m_f->m_bndRegionsToWrite.size()-1)
{
cout << ",";
......@@ -108,7 +107,7 @@ namespace Nektar
for(int i = 0; i < m_f->m_bndRegionsToWrite.size(); ++i)
{
string outname = name + "_b" +
boost::lexical_cast<string>(i) + "." + ext;
boost::lexical_cast<string>(m_f->m_bndRegionsToWrite[i]) + "." + ext;