Commit 34ad3c47 authored by Spencer Sherwin's avatar Spencer Sherwin
Browse files

Fixed issue with collectionsoptimisation not being able to set defaults back...

Fixed issue with collectionsoptimisation not being able to set defaults back to eNoCollections option. Also added the adbilty to define a default option to ExpList so that these can be called from FieldConvert as defined in field.hpp
parent d187e94c
......@@ -84,11 +84,16 @@ CollectionOptimisation::CollectionOptimisation(
{
for (it2 = elTypes.begin(); it2 != elTypes.end(); ++it2)
{
defaultsPhysDeriv [ElmtOrder(it2->second, -1)] = eNoCollection;
// For 1<=N<=5 use StdMat otherwise IterPerExp or given default type
for (int i = 1; i < 5; ++i)
{
defaults[ElmtOrder(it2->second, i)] = eStdMat;
}
// For 1<=N<=3 use SumFac otherwise NoCollection. Note that
// default is not currently overwritten by given default
// type
defaultsPhysDeriv [ElmtOrder(it2->second, -1)] = eNoCollection;
for (int i = 1; i < 3; ++i)
{
defaultsPhysDeriv[ElmtOrder(it2->second, i)] = eSumFac;
......@@ -157,6 +162,7 @@ CollectionOptimisation::CollectionOptimisation(
ASSERTL0(i != Collections::SIZE_ImplementationType,
"Unknown default collection scheme: "+collinfo);
defaults.clear();
// Override default types
for (it2 = elTypes.begin(); it2 != elTypes.end(); ++it2)
{
......
......@@ -177,7 +177,8 @@ struct Field
Exp2DH1 =
MemoryManager<MultiRegions::ExpList2DHomogeneous1D>::
AllocateSharedPtr(m_session, Bkey, ly, m_useFFT,
dealiasing, m_graph);
dealiasing, m_graph,
Collections::eNoCollection);
exp = Exp2DH1;
}
else if (NumHomogeneousDir == 2)
......@@ -223,7 +224,8 @@ struct Field
MultiRegions::ContField3DHomogeneous2D>::
AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
m_useFFT, dealiasing, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
Collections::eNoCollection);
}
else if (m_declareExpansionAsDisContField)
{
......@@ -231,14 +233,16 @@ struct Field
MultiRegions::DisContField3DHomogeneous2D>::
AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
m_useFFT, dealiasing, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
Collections::eNoCollection);
}
else
{
Exp3DH2 = MemoryManager<
MultiRegions::ExpList3DHomogeneous2D>::
AllocateSharedPtr(m_session, BkeyY, BkeyZ, ly, lz,
m_useFFT, dealiasing, m_graph);
m_useFFT, dealiasing, m_graph,
Collections::eNoCollection);
}
exp = Exp3DH2;
......@@ -251,18 +255,23 @@ struct Field
{
Exp1D = MemoryManager<MultiRegions::ContField1D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
Collections::eNoCollection);
}
else if (m_declareExpansionAsDisContField)
{
Exp1D = MemoryManager<MultiRegions::DisContField1D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
true,
Collections::eNoCollection);
}
else
{
Exp1D = MemoryManager<MultiRegions::ExpList1D>::
AllocateSharedPtr(m_session, m_graph);
AllocateSharedPtr(m_session, m_graph,
true,
Collections::eNoCollection);
}
exp = Exp1D;
......@@ -327,7 +336,8 @@ struct Field
MultiRegions::ContField3DHomogeneous1D>::
AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
dealiasing, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
Collections::eNoCollection);
}
else if (m_declareExpansionAsDisContField)
{
......@@ -335,14 +345,17 @@ struct Field
MultiRegions::DisContField3DHomogeneous1D>::
AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
dealiasing, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
Collections::eNoCollection);
}
else
{
Exp3DH1 = MemoryManager<
MultiRegions::ExpList3DHomogeneous1D>::
AllocateSharedPtr(m_session, Bkey, lz, m_useFFT,
dealiasing, m_graph);
dealiasing, m_graph,
"DefaultVar",
Collections::eNoCollection);
}
exp = Exp3DH1;
}
......@@ -354,18 +367,25 @@ struct Field
{
Exp2D = MemoryManager<MultiRegions::ContField2D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
true,false,
Collections::eNoCollection);
}
else if (m_declareExpansionAsDisContField)
{
Exp2D = MemoryManager<MultiRegions::DisContField2D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
true,true,
Collections::eNoCollection);
}
else
{
Exp2D = MemoryManager<MultiRegions::ExpList2D>::
AllocateSharedPtr(m_session, m_graph);
AllocateSharedPtr(m_session, m_graph,
true,
"DefaultVar",
Collections::eNoCollection);
}
exp = Exp2D;
......@@ -380,19 +400,26 @@ struct Field
{
Exp3D = MemoryManager<MultiRegions::ContField3D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
false,
Collections::eNoCollection);
}
else if (m_declareExpansionAsDisContField)
{
Exp3D = MemoryManager<MultiRegions::DisContField3D>::
AllocateSharedPtr(m_session, m_graph,
m_session->GetVariable(0));
m_session->GetVariable(0),
true,
Collections::eNoCollection);
}
else
{
Exp3D = MemoryManager<
MultiRegions::ExpList3D>::AllocateSharedPtr(m_session,
m_graph);
MultiRegions::ExpList3D>::AllocateSharedPtr(
m_session,
m_graph,
"DefaultVar",
Collections::eNoCollection);
}
exp = Exp3D;
......
......@@ -114,10 +114,12 @@ namespace Nektar
* @param variable An optional parameter to indicate for which
* variable the field should be constructed.
*/
ContField1D::ContField1D(const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable):
DisContField1D(pSession,graph1D,variable,false),
ContField1D::ContField1D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable,
const Collections::ImplementationType ImpType):
DisContField1D(pSession,graph1D,variable,false,ImpType),
m_locToGloMap(),
m_globalLinSysManager(
boost::bind(&ContField1D::GenGlobalLinSys, this, _1),
......
......@@ -64,7 +64,9 @@ namespace Nektar
MULTI_REGIONS_EXPORT ContField1D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable = "DefaultVar");
const std::string &variable = "DefaultVar",
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Copy constructor.
MULTI_REGIONS_EXPORT ContField1D(const ContField1D &In);
......
......@@ -117,12 +117,14 @@ namespace Nektar
* @param variable An optional parameter to indicate for which
* variable the field should be constructed.
*/
ContField2D::ContField2D(const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool DeclareCoeffPhysArrays,
const bool CheckIfSingularSystem):
DisContField2D(pSession,graph2D,variable,false,DeclareCoeffPhysArrays),
ContField2D::ContField2D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool DeclareCoeffPhysArrays,
const bool CheckIfSingularSystem,
const Collections::ImplementationType ImpType):
DisContField2D(pSession,graph2D,variable,false,DeclareCoeffPhysArrays,ImpType),
m_globalMat(MemoryManager<GlobalMatrixMap>::AllocateSharedPtr()),
m_globalLinSysManager(
boost::bind(&ContField2D::GenGlobalLinSys, this, _1),
......
......@@ -66,7 +66,9 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable = "DefaultVar",
const bool DeclareCoeffPhysArrays = true,
const bool CheckIfSingularSystem = false);
const bool CheckIfSingularSystem = false,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Construct a global continuous field with solution type based on
/// another field but using a separate input mesh and boundary
......
......@@ -79,8 +79,9 @@ namespace Nektar
ContField3D::ContField3D(const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string &variable,
const bool CheckIfSingularSystem):
DisContField3D(pSession,graph3D,variable,false),
const bool CheckIfSingularSystem,
const Collections::ImplementationType ImpType):
DisContField3D(pSession,graph3D,variable,false,ImpType),
m_globalMat(MemoryManager<GlobalMatrixMap>::AllocateSharedPtr()),
m_globalLinSysManager(
boost::bind(&ContField3D::GenGlobalLinSys, this, _1),
......
......@@ -58,7 +58,9 @@ namespace Nektar
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string &variable = "DefaultVar",
const bool CheckIfSingularSystem = false);
const bool CheckIfSingularSystem = false,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Construct a global continuous field with solution type based on
/// another field but using a separate input mesh and boundary
......
......@@ -66,10 +66,10 @@ namespace Nektar
}
ContField3DHomogeneous1D::ContField3DHomogeneous1D(
const ContField3DHomogeneous1D &In,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable):
DisContField3DHomogeneous1D (In, false)
const ContField3DHomogeneous1D &In,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable):
DisContField3DHomogeneous1D (In, false)
{
ContField2DSharedPtr zero_plane_old =
boost::dynamic_pointer_cast<ContField2D> (In.m_planes[0]);
......@@ -101,15 +101,17 @@ namespace Nektar
}
ContField3DHomogeneous1D::ContField3DHomogeneous1D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis,
const NekDouble lhom,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool CheckIfSingularSystem):
DisContField3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing)
const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis,
const NekDouble lhom,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool CheckIfSingularSystem,
const Collections::ImplementationType ImpType):
DisContField3DHomogeneous1D(pSession,HomoBasis,lhom,
useFFT,dealiasing)
{
int i,n,nel;
ContField2DSharedPtr plane_zero;
......@@ -122,11 +124,11 @@ namespace Nektar
// problems
plane_zero = MemoryManager<ContField2D>::AllocateSharedPtr(
pSession, graph2D, variable, false,
CheckIfSingularSystem);
CheckIfSingularSystem, ImpType);
plane_two = MemoryManager<ContField2D>::AllocateSharedPtr(
pSession, graph2D, variable, false,
false);
false, ImpType);
m_exp = MemoryManager<LocalRegions::ExpansionVector>
::AllocateSharedPtr();
......
......@@ -53,11 +53,13 @@ namespace Nektar
const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis,
const NekDouble lhom,
const bool useFFT,
const bool dealiasing,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool CheckIfSingularSystem = false);
const bool CheckIfSingularSystem = false,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Copy constructor.
MULTI_REGIONS_EXPORT ContField3DHomogeneous1D(const ContField3DHomogeneous1D &In);
......
......@@ -47,7 +47,8 @@ namespace Nektar
{
}
ContField3DHomogeneous2D::ContField3DHomogeneous2D(const ContField3DHomogeneous2D &In):
ContField3DHomogeneous2D::ContField3DHomogeneous2D(
const ContField3DHomogeneous2D &In):
DisContField3DHomogeneous2D (In,false)
{
......@@ -65,22 +66,24 @@ namespace Nektar
{
}
ContField3DHomogeneous2D::ContField3DHomogeneous2D(const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis_y,
const LibUtilities::BasisKey &HomoBasis_z,
const NekDouble lhom_y,
const NekDouble lhom_z,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable):
DisContField3DHomogeneous2D(pSession,HomoBasis_y,HomoBasis_z,lhom_y,lhom_z,useFFT,dealiasing)
ContField3DHomogeneous2D::ContField3DHomogeneous2D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis_y,
const LibUtilities::BasisKey &HomoBasis_z,
const NekDouble lhom_y,
const NekDouble lhom_z,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable,
const Collections::ImplementationType ImpType):
DisContField3DHomogeneous2D(pSession,HomoBasis_y,HomoBasis_z,lhom_y,lhom_z,useFFT,dealiasing,ImpType)
{
int i,n,nel;
ContField1DSharedPtr line_zero;
SpatialDomains::BoundaryConditions bcs(pSession, graph1D);
m_lines[0] = line_zero = MemoryManager<ContField1D>::AllocateSharedPtr(pSession,graph1D,variable);
m_lines[0] = line_zero = MemoryManager<ContField1D>::AllocateSharedPtr(pSession,graph1D,variable,ImpType);
m_exp = MemoryManager<LocalRegions::ExpansionVector>::AllocateSharedPtr();
nel = m_lines[0]->GetExpSize();
......@@ -95,7 +98,7 @@ namespace Nektar
for(n = 1; n < nylines*nzlines; ++n)
{
m_lines[n] = MemoryManager<ContField1D>::AllocateSharedPtr(pSession,graph1D,variable);
m_lines[n] = MemoryManager<ContField1D>::AllocateSharedPtr(pSession,graph1D,variable,ImpType);
for(i = 0; i < nel; ++i)
{
......
......@@ -49,18 +49,22 @@ namespace Nektar
public:
MULTI_REGIONS_EXPORT ContField3DHomogeneous2D();
MULTI_REGIONS_EXPORT ContField3DHomogeneous2D(const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis_y,
const LibUtilities::BasisKey &HomoBasis_z,
const NekDouble lhom_y,
const NekDouble lhom_z,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable);
MULTI_REGIONS_EXPORT ContField3DHomogeneous2D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const LibUtilities::BasisKey &HomoBasis_y,
const LibUtilities::BasisKey &HomoBasis_z,
const NekDouble lhom_y,
const NekDouble lhom_z,
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Copy constructor.
MULTI_REGIONS_EXPORT ContField3DHomogeneous2D(const ContField3DHomogeneous2D &In);
MULTI_REGIONS_EXPORT ContField3DHomogeneous2D(
const ContField3DHomogeneous2D &In);
/// Destructor.
MULTI_REGIONS_EXPORT virtual ~ContField3DHomogeneous2D();
......
......@@ -79,8 +79,9 @@ namespace Nektar
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable,
const bool SetUpJustDG)
: ExpList1D(pSession,graph1D),
const bool SetUpJustDG,
const Collections::ImplementationType ImpType)
: ExpList1D(pSession,graph1D,true, ImpType),
m_bndCondExpansions(),
m_bndConditions()
{
......@@ -449,13 +450,14 @@ namespace Nektar
* which the DisContField1D is set up
*/
DisContField1D::DisContField1D(
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const SpatialDomains::CompositeMap &domain,
const SpatialDomains::BoundaryConditions &Allbcs,
const std::string &variable,
bool SetToOneSpaceDimension):
ExpList1D(pSession,graph1D,domain, true,variable,SetToOneSpaceDimension),
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const SpatialDomains::CompositeMap &domain,
const SpatialDomains::BoundaryConditions &Allbcs,
const std::string &variable,
bool SetToOneSpaceDimension,
const Collections::ImplementationType ImpType):
ExpList1D(pSession,graph1D,domain, true,variable,SetToOneSpaceDimension,ImpType),
m_bndCondExpansions(),
m_bndConditions()
{
......
......@@ -64,7 +64,9 @@ namespace Nektar
const LibUtilities::SessionReaderSharedPtr& pSession,
const SpatialDomains::MeshGraphSharedPtr &graph1D,
const std::string &variable,
const bool SetUpJustDG = true);
const bool SetUpJustDG = true,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Constructor for a DisContField1D from a List of subdomains
/// New Constructor for arterial network
......@@ -74,7 +76,9 @@ namespace Nektar
const SpatialDomains::CompositeMap& domain,
const SpatialDomains::BoundaryConditions &Allbcs,
const std::string &variable,
bool SetToOneSpaceDimensions = false);
bool SetToOneSpaceDimensions = false,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
/// Constructs a 1D discontinuous field based on an existing field.
MULTI_REGIONS_EXPORT DisContField1D(const DisContField1D &In);
......
......@@ -101,8 +101,10 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool SetUpJustDG,
const bool DeclareCoeffPhysArrays)
: ExpList2D(pSession, graph2D, DeclareCoeffPhysArrays, variable),
const bool DeclareCoeffPhysArrays,
const Collections::ImplementationType ImpType)
: ExpList2D(pSession, graph2D, DeclareCoeffPhysArrays, variable,
ImpType),
m_bndCondExpansions(),
m_bndConditions(),
m_trace(NullExpListSharedPtr),
......@@ -193,8 +195,8 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool SetUpJustDG,
const bool DeclareCoeffPhysArrays)
: ExpList2D(In,DeclareCoeffPhysArrays),
const bool DeclareCoeffPhysArrays):
ExpList2D(In,DeclareCoeffPhysArrays),
m_trace(NullExpListSharedPtr)
{
// Set up boundary conditions for this variable.
......
......@@ -59,7 +59,9 @@ namespace Nektar
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable,
const bool SetUpJustDG = true,
const bool DeclareCoeffPhysArrays = true);
const bool DeclareCoeffPhysArrays = true,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
MULTI_REGIONS_EXPORT DisContField2D(
const DisContField2D &In,
......
......@@ -79,8 +79,9 @@ using namespace boost::assign;
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string &variable,
const bool SetUpJustDG)
: ExpList3D (pSession, graph3D, variable),
const bool SetUpJustDG,
const Collections::ImplementationType ImpType):
ExpList3D (pSession, graph3D, variable, ImpType),
m_bndCondExpansions(),
m_bndConditions (),
m_trace(NullExpListSharedPtr)
......
......@@ -61,7 +61,9 @@ namespace Nektar
const LibUtilities::SessionReaderSharedPtr &pSession,
const SpatialDomains::MeshGraphSharedPtr &graph3D,
const std::string &variable,
const bool SetUpJustDG = true);
const bool SetUpJustDG = true,
const Collections::ImplementationType ImpType
= Collections::eNoImpType);
MULTI_REGIONS_EXPORT DisContField3D(
const DisContField3D &In,
......
......@@ -56,8 +56,8 @@ namespace Nektar
const LibUtilities::BasisKey &HomoBasis,
const NekDouble lhom,
const bool useFFT,
const bool dealiasing)
: ExpList3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing),
const bool dealiasing):
ExpList3DHomogeneous1D(pSession,HomoBasis,lhom,useFFT,dealiasing),
m_bndCondExpansions(),
m_bndConditions()
{
......@@ -93,9 +93,10 @@ namespace Nektar
const bool useFFT,
const bool dealiasing,
const SpatialDomains::MeshGraphSharedPtr &graph2D,
const std::string &variable)
: ExpList3DHomogeneous1D(pSession, HomoBasis, lhom, useFFT,
dealiasing),
const std::string &variable,
const Collections::ImplementationType ImpType):
ExpList3DHomogeneous1D(pSession, HomoBasis, lhom, useFFT,
dealiasing),
m_bndCondExpansions(),
m_bndConditions()
{
......@@ -105,7 +106,8 @@ namespace Nektar
// note that nzplanes can be larger than nzmodes
m_planes[0] = plane_zero = MemoryManager<DisContField2D>::
AllocateSharedPtr(pSession, graph2D, variable, true, false);
AllocateSharedPtr(pSession, graph2D, variable, true, false,
ImpType);
m_exp = MemoryManager<LocalRegions::ExpansionVector>
::AllocateSharedPtr();
......@@ -136,7 +138,8 @@ namespace Nektar
}
m_trace = MemoryManager<ExpList2DHomogeneous1D>::AllocateSharedPtr(
pSession, HomoBasis, lhom, useFFT, dealiasing, trace);
pSession, HomoBasis, lhom, useFFT,
dealiasing, trace);
// Setup default optimisation information
nel = GetExpSize();
......