Commit 96700a93 authored by Alessandro Bolis's avatar Alessandro Bolis
Browse files

Output tags for homogeneous parallel applications


git-svn-id: https://gforge.sci.utah.edu/svn/nektar/trunk@3723 305cdda6-5ce1-45b3-a98d-dfc68c8b3305
parent 1e1c86d9
......@@ -71,7 +71,7 @@ namespace Nektar
{
#ifndef NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS
#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS 13
#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS 15
#endif //NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS
/// @brief General purpose memory allocation routines with the ability
......
......@@ -1840,7 +1840,12 @@ namespace Nektar
return sqrt(err);
}
void ExpList::GeneralGetFieldDefinitions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef, int NumHomoDir, Array<OneD, LibUtilities::BasisSharedPtr> &HomoBasis, std::vector<NekDouble> &HomoLen)
void ExpList::GeneralGetFieldDefinitions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef,
int NumHomoDir,
Array<OneD, LibUtilities::BasisSharedPtr> &HomoBasis,
std::vector<NekDouble> &HomoLen,
std::vector<unsigned int> &HomoZIDs,
std::vector<unsigned int> &HomoYIDs)
{
int startenum, endenum, s;
......@@ -1923,7 +1928,7 @@ namespace Nektar
if(elementIDs.size() > 0)
{
SpatialDomains::FieldDefinitionsSharedPtr fdef = MemoryManager<SpatialDomains::FieldDefinitions>::AllocateSharedPtr(shape, elementIDs, basis, UniOrder, numModes,fields, NumHomoDir, HomoLen);
SpatialDomains::FieldDefinitionsSharedPtr fdef = MemoryManager<SpatialDomains::FieldDefinitions>::AllocateSharedPtr(shape, elementIDs, basis, UniOrder, numModes,fields, NumHomoDir, HomoLen, HomoZIDs, HomoYIDs);
fielddef.push_back(fdef);
}
}
......
......@@ -634,7 +634,12 @@ namespace Nektar
inline void GetBoundaryToElmtMap(Array<OneD, int> &ElmtID,
Array<OneD,int> &EdgeID);
MULTI_REGIONS_EXPORT void GeneralGetFieldDefinitions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef, int NumHomoDir = 0, Array<OneD, LibUtilities::BasisSharedPtr> &HomoBasis = LibUtilities::NullBasisSharedPtr1DArray, std::vector<NekDouble> &HomoLen = SpatialDomains::NullNekDoubleVector);
MULTI_REGIONS_EXPORT void GeneralGetFieldDefinitions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef,
int NumHomoDir = 0,
Array<OneD, LibUtilities::BasisSharedPtr> &HomoBasis = LibUtilities::NullBasisSharedPtr1DArray,
std::vector<NekDouble> &HomoLen = SpatialDomains::NullNekDoubleVector,
std::vector<unsigned int> &HomoZIDs = SpatialDomains::NullUnsignedIntVector,
std::vector<unsigned int> &HomoYIDs = SpatialDomains::NullUnsignedIntVector);
const NekOptimize::GlobalOptParamSharedPtr &GetGlobalOptParam(void)
{
......@@ -1098,8 +1103,7 @@ namespace Nektar
virtual void v_ReadGlobalOptimizationParameters();
virtual std::vector<SpatialDomains::FieldDefinitionsSharedPtr>
v_GetFieldDefinitions(void);
virtual std::vector<SpatialDomains::FieldDefinitionsSharedPtr> v_GetFieldDefinitions(void);
virtual void v_GetFieldDefinitions(std::vector<SpatialDomains::FieldDefinitionsSharedPtr> &fielddef);
......
......@@ -658,13 +658,13 @@ namespace Nektar
std::vector<NekDouble> HomoLen;
HomoLen.push_back(m_lhom);
std::vector<int> PlanesIDs(m_num_planes_per_proc);
std::vector<unsigned int> PlanesIDs(m_num_planes_per_proc);
for(int i = 0; i < m_num_planes_per_proc; i++)
{
PlanesIDs.push_back(m_planes_IDs[i]);
}
m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis, HomoLen);
m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis, HomoLen, PlanesIDs);
return returnval;
}
......@@ -677,14 +677,14 @@ namespace Nektar
std::vector<NekDouble> HomoLen;
HomoLen.push_back(m_lhom);
std::vector<int> PlanesIDs(m_num_planes_per_proc);
std::vector<unsigned int> PlanesIDs(m_num_planes_per_proc);
for(int i = 0; i < m_num_planes_per_proc; i++)
{
PlanesIDs.push_back(m_planes_IDs[i]);
}
// enforce NumHomoDir == 1 by direct call
m_planes[0]->GeneralGetFieldDefinitions(fielddef,1, HomoBasis,HomoLen);
m_planes[0]->GeneralGetFieldDefinitions(fielddef,1, HomoBasis,HomoLen,PlanesIDs);
}
......@@ -732,7 +732,7 @@ namespace Nektar
{
if(fielddef->m_basis[i] == m_homogeneousBasis->GetBasisType())
{
nzmodes = fielddef->m_numModes[i];
nzmodes = fielddef->m_homogeneousZIDs.size();
break;
}
}
......
......@@ -1291,6 +1291,46 @@ namespace Nektar
}
elemTag->SetAttribute("HOMOGENEOUSLENGTHS", homoLenString);
}
// Write homogeneuous planes/lines details
if(fielddefs[f]->m_numHomogeneousDir)
{
if(fielddefs[f]->m_homogeneousYIDs.size() > 0)
{
std::string homoYIDsString;
{
std::stringstream homoYIDsStringStream;
bool first = true;
for(int i = 0; i < fielddefs[f]->m_homogeneousYIDs.size(); i++)
{
if (!first)
homoYIDsStringStream << ",";
homoYIDsStringStream << fielddefs[f]->m_homogeneousYIDs[i];
first = false;
}
homoYIDsString = homoYIDsStringStream.str();
}
elemTag->SetAttribute("HOMOGENEOUSYIDS", homoYIDsString);
}
if(fielddefs[f]->m_homogeneousZIDs.size() > 0)
{
std::string homoZIDsString;
{
std::stringstream homoZIDsStringStream;
bool first = true;
for(int i = 0; i < fielddefs[f]->m_homogeneousZIDs.size(); i++)
{
if (!first)
homoZIDsStringStream << ",";
homoZIDsStringStream << fielddefs[f]->m_homogeneousZIDs[i];
first = false;
}
homoZIDsString = homoZIDsStringStream.str();
}
elemTag->SetAttribute("HOMOGENEOUSZIDS", homoZIDsString);
}
}
// Write NUMMODESPERDIR
std::string numModesString;
......@@ -1450,6 +1490,8 @@ namespace Nektar
std::string shapeString;
std::string basisString;
std::string homoLengthsString;
std::string homoZIDsString;
std::string homoYIDsString;
std::string numModesString;
std::string numPointsString;
std::string fieldsString;
......@@ -1475,6 +1517,14 @@ namespace Nektar
else if (attrName == "HOMOGENEOUSLENGTHS")
{
homoLengthsString.insert(0,attr->Value());
}
else if (attrName == "HOMOGENEOUSZIDS")
{
homoZIDsString.insert(0,attr->Value());
}
else if (attrName == "HOMOGENEOUSYIDS")
{
homoYIDsString.insert(0,attr->Value());
}
else if (attrName == "NUMMODESPERDIR")
{
......@@ -1573,6 +1623,25 @@ namespace Nektar
valid = ParseUtils::GenerateUnOrderedVector(homoLengthsString.c_str(), homoLengths);
ASSERTL0(valid, "Unable to correctly parse the number of homogeneous lengths.");
}
// Get Homogeneous points IDs
std::vector<unsigned int> homoZIDs;
std::vector<unsigned int> homoYIDs;
if(numHomoDir == 1)
{
valid = ParseUtils::GenerateSeqVector(homoZIDsString.c_str(), homoZIDs);
ASSERTL0(valid, "Unable to correctly parse homogeneous planes IDs.");
}
if(numHomoDir == 2)
{
valid = ParseUtils::GenerateSeqVector(homoZIDsString.c_str(), homoZIDs);
ASSERTL0(valid, "Unable to correctly parse homogeneous lines IDs in z-direction.");
valid = ParseUtils::GenerateSeqVector(homoYIDsString.c_str(), homoYIDs);
ASSERTL0(valid, "Unable to correctly parse homogeneous lines IDs in y-direction.");
}
// Get points type
std::vector<LibUtilities::PointsType> points;
......@@ -1624,8 +1693,9 @@ namespace Nektar
valid = ParseUtils::GenerateOrderedStringVector(fieldsString.c_str(), Fields);
ASSERTL0(valid, "Unable to correctly parse the number of fields.");
SpatialDomains::FieldDefinitionsSharedPtr fielddef = MemoryManager<SpatialDomains::FieldDefinitions>::AllocateSharedPtr(shape, elementIds, basis, UniOrder, numModes, Fields, numHomoDir, homoLengths, points, pointDef, numPoints, numPointDef);
int datasize = CheckFieldDefinition(fielddef);
SpatialDomains::FieldDefinitionsSharedPtr fielddef = MemoryManager<SpatialDomains::FieldDefinitions>::AllocateSharedPtr(shape, elementIds, basis, UniOrder, numModes, Fields, numHomoDir, homoLengths, homoZIDs, homoYIDs, points, pointDef, numPoints, numPointDef);
int datasize = CheckFieldDefinition(fielddef);
fielddefs.push_back(fielddef);
......
......@@ -158,6 +158,10 @@ namespace Nektar
int NumHomoDir = 0,
const std::vector<NekDouble> &HomoLengths =
NullNekDoubleVector,
const std::vector<unsigned int> &HomoZIDs =
NullUnsignedIntVector,
const std::vector<unsigned int> &HomoYIDs =
NullUnsignedIntVector,
const std::vector<LibUtilities::PointsType> &points =
NullPointsTypeVector,
bool pointsDef = false,
......@@ -169,6 +173,8 @@ namespace Nektar
m_basis(basis),
m_numHomogeneousDir(NumHomoDir),
m_homogeneousLengths(HomoLengths),
m_homogeneousZIDs(HomoZIDs),
m_homogeneousYIDs(HomoYIDs),
m_points(points),
m_pointsDef(pointsDef),
m_uniOrder(uniOrder),
......@@ -179,11 +185,14 @@ namespace Nektar
{
}
SpatialDomains::GeomShapeType m_shapeType;
std::vector<unsigned int> m_elementIDs;
std::vector<LibUtilities::BasisType> m_basis;
int m_numHomogeneousDir;
std::vector<NekDouble> m_homogeneousLengths;
SpatialDomains::GeomShapeType m_shapeType;
std::vector<unsigned int> m_elementIDs;
std::vector<LibUtilities::BasisType> m_basis;
int m_numHomogeneousDir;
std::vector<NekDouble> m_homogeneousLengths;
std::vector<unsigned int> m_homogeneousZIDs;
std::vector<unsigned int> m_homogeneousYIDs;
/// Define the type of points per direction.
std::vector<LibUtilities::PointsType> m_points;
bool m_pointsDef;
......
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