Commit 1f98ed4f authored by Yan Bao's avatar Yan Bao
Browse files

set attribute of HomostripsIDs in. fld

parent 5ea31eca
......@@ -298,6 +298,24 @@ namespace Nektar
}
elemTag->SetAttribute("HOMOGENEOUSZIDS", homoZIDsString);
}
if(fielddefs[f]->m_homogeneousSIDs.size() > 0)
{
std::string homoSIDsString;
{
std::stringstream homoSIDsStringStream;
bool first = true;
for(int i = 0; i < fielddefs[f]->m_homogeneousSIDs.size(); i++)
{
if (!first)
homoSIDsStringStream << ",";
homoSIDsStringStream << fielddefs[f]->m_homogeneousSIDs[i];
first = false;
}
homoSIDsString = homoSIDsStringStream.str();
}
elemTag->SetAttribute("HOMOGENEOUSSIDS", homoSIDsString);
}
}
// Write NUMMODESPERDIR
......@@ -730,6 +748,7 @@ namespace Nektar
std::string shapeString;
std::string basisString;
std::string homoLengthsString;
std::string homoSIDsString;
std::string homoZIDsString;
std::string homoYIDsString;
std::string numModesString;
......@@ -758,6 +777,10 @@ namespace Nektar
{
homoLengthsString.insert(0,attr->Value());
}
else if (attrName == "HOMOGENEOUSSIDS")
{
homoSIDsString.insert(0,attr->Value());
}
else if (attrName == "HOMOGENEOUSZIDS")
{
homoZIDsString.insert(0,attr->Value());
......@@ -864,6 +887,13 @@ namespace Nektar
ASSERTL0(valid, "Unable to correctly parse the number of homogeneous lengths.");
}
// Get Homogeneous strips IDs
std::vector<unsigned int> homoSIDs;
if(numHomoDir == 1)
{
valid = ParseUtils::GenerateSeqVector(homoSIDsString.c_str(), homoSIDs);
ASSERTL0(valid, "Unable to correctly parse homogeneous strips IDs.");
}
// Get Homogeneous points IDs
std::vector<unsigned int> homoZIDs;
std::vector<unsigned int> homoYIDs;
......@@ -933,7 +963,7 @@ namespace Nektar
valid = ParseUtils::GenerateOrderedStringVector(fieldsString.c_str(), Fields);
ASSERTL0(valid, "Unable to correctly parse the number of fields.");
FieldDefinitionsSharedPtr fielddef = MemoryManager<FieldDefinitions>::AllocateSharedPtr(shape, elementIds, basis, UniOrder, numModes, Fields, numHomoDir, homoLengths, homoZIDs, homoYIDs, points, pointDef, numPoints, numPointDef);
FieldDefinitionsSharedPtr fielddef = MemoryManager<FieldDefinitions>::AllocateSharedPtr(shape, elementIds, basis, UniOrder, numModes, Fields, numHomoDir, homoLengths, homoSIDs, homoZIDs, homoYIDs, points, pointDef, numPoints, numPointDef);
fielddefs.push_back(fielddef);
......
......@@ -79,6 +79,8 @@ namespace Nektar
int NumHomoDir = 0,
const std::vector<NekDouble> &HomoLengths =
NullNekDoubleVector,
const std::vector<unsigned int> &HomoSIDs =
NullUnsignedIntVector,
const std::vector<unsigned int> &HomoZIDs =
NullUnsignedIntVector,
const std::vector<unsigned int> &HomoYIDs =
......@@ -94,6 +96,7 @@ namespace Nektar
m_basis(basis),
m_numHomogeneousDir(NumHomoDir),
m_homogeneousLengths(HomoLengths),
m_homogeneousSIDs(HomoSIDs),
m_homogeneousZIDs(HomoZIDs),
m_homogeneousYIDs(HomoYIDs),
m_points(points),
......@@ -111,6 +114,7 @@ namespace Nektar
std::vector<LibUtilities::BasisType> m_basis;
int m_numHomogeneousDir;
std::vector<NekDouble> m_homogeneousLengths;
std::vector<unsigned int> m_homogeneousSIDs;
std::vector<unsigned int> m_homogeneousZIDs;
std::vector<unsigned int> m_homogeneousYIDs;
......
......@@ -50,9 +50,10 @@ namespace Nektar
* Constructor for 1D transform.
*/
Transposition::Transposition(const LibUtilities::BasisKey &HomoBasis0,
LibUtilities::CommSharedPtr hcomm)
LibUtilities::CommSharedPtr hcomm0,
LibUtilities::CommSharedPtr hcomm1)
{
m_hcomm = hcomm;
m_hcomm = hcomm1;
m_num_homogeneous_directions = 1;
m_num_points_per_proc =
......@@ -81,6 +82,17 @@ namespace Nektar
m_planes_IDs[i] = m_rank_id*m_num_points_per_proc[0] + i;
}
int global_rank_id = hcomm0->GetColumnComm()->GetRank();
int NumStrips = hcomm0->GetColumnComm()->GetSize() /
m_hcomm->GetSize();
m_strip_ID = 0;
if (NumStrips > 1)
{
m_strip_ID =
(NumStrips > global_rank_id) ? global_rank_id:(global_rank_id - NumStrips);
}
if(HomoBasis0.GetBasisType() == LibUtilities::eFourier)
{
for(int i = 0 ; i < m_num_points_per_proc[0] ; i++)
......@@ -199,6 +211,10 @@ namespace Nektar
return m_planes_IDs;
}
unsigned int Transposition::GetStripID(void)
{
return m_strip_ID;
}
/**
* Main method: General transposition, the dir parameters define if
......
......@@ -65,7 +65,8 @@ namespace Nektar
public:
LIB_UTILITIES_EXPORT Transposition(
const LibUtilities::BasisKey &HomoBasis0,
LibUtilities::CommSharedPtr hcomm);
LibUtilities::CommSharedPtr hcomm0,
LibUtilities::CommSharedPtr hcomm1);
LIB_UTILITIES_EXPORT Transposition(
const LibUtilities::BasisKey &HomoBasis0,
......@@ -86,6 +87,8 @@ namespace Nektar
LIB_UTILITIES_EXPORT unsigned int GetPlaneID(int i);
LIB_UTILITIES_EXPORT unsigned int GetStripID(void);
LIB_UTILITIES_EXPORT Array<OneD, unsigned int> GetPlanesIDs(void);
LIB_UTILITIES_EXPORT void Transpose(
......@@ -152,6 +155,9 @@ namespace Nektar
/// IDs of the planes on the processes.
Array<OneD, unsigned int> m_planes_IDs;
/// IDs of the strips on the processes.
unsigned int m_strip_ID;
/// Fourier wave numbers associated with the planes.
Array<OneD, unsigned int> m_K;
......
......@@ -71,7 +71,7 @@ namespace Nektar
{
#ifndef NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS
#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS 15
#define NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS 16
#endif //NEKTAR_MAX_MEMORY_MANAGER_CONSTRUCTOR_ARGS
/// @brief General purpose memory allocation routines with the ability
......
......@@ -1938,9 +1938,10 @@ namespace Nektar
int NumHomoDir,
Array<OneD, LibUtilities::BasisSharedPtr> &HomoBasis,
std::vector<NekDouble> &HomoLen,
std::vector<unsigned int> &HomoSIDs,
std::vector<unsigned int> &HomoZIDs,
std::vector<unsigned int> &HomoYIDs)
{
{
int startenum = (int) LibUtilities::eSegment;
int endenum = (int) LibUtilities::eHexahedron;
int s = 0;
......@@ -2029,8 +2030,8 @@ namespace Nektar
MemoryManager<LibUtilities::FieldDefinitions>::
AllocateSharedPtr(shape, elementIDs, basis,
UniOrder, numModes,fields,
NumHomoDir, HomoLen, HomoZIDs,
HomoYIDs);
NumHomoDir, HomoLen, HomoSIDs,
HomoZIDs, HomoYIDs);
fielddef.push_back(fdef);
}
}
......
......@@ -737,6 +737,8 @@ namespace Nektar
LibUtilities::NullBasisSharedPtr1DArray,
std::vector<NekDouble> &HomoLen =
LibUtilities::NullNekDoubleVector,
std::vector<unsigned int> &HomoSIDs =
LibUtilities::NullUnsignedIntVector,
std::vector<unsigned int> &HomoZIDs =
LibUtilities::NullUnsignedIntVector,
std::vector<unsigned int> &HomoYIDs =
......
......@@ -70,7 +70,7 @@ namespace Nektar
m_comm->GetColumnComm();
m_transposition = MemoryManager<LibUtilities::Transposition>
::AllocateSharedPtr(HomoBasis, m_StripZcomm);
::AllocateSharedPtr(HomoBasis, m_comm, m_StripZcomm);
m_planes = Array<OneD,ExpListSharedPtr>(
m_homogeneousBasis->GetNumPoints() /
......@@ -606,6 +606,10 @@ namespace Nektar
std::vector<NekDouble> HomoLen;
HomoLen.push_back(m_lhom);
std::vector<unsigned int> StripsIDs;
StripsIDs.push_back(m_transposition->GetStripID());
std::vector<unsigned int> PlanesIDs;
for(int i = 0; i < m_planes.num_elements(); i++)
......@@ -613,11 +617,7 @@ namespace Nektar
PlanesIDs.push_back(m_transposition->GetPlaneID(i));
}
int NumHomoStrip;
m_session->LoadParameter("Strip_Z",NumHomoStrip,1);
m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis, HomoLen, PlanesIDs);
m_planes[0]->GeneralGetFieldDefinitions(returnval, 1, HomoBasis, HomoLen, StripsIDs, PlanesIDs);
return returnval;
}
......@@ -629,6 +629,10 @@ namespace Nektar
std::vector<NekDouble> HomoLen;
HomoLen.push_back(m_lhom);
std::vector<unsigned int> StripsIDs;
StripsIDs.push_back(m_transposition->GetStripID());
std::vector<unsigned int> PlanesIDs;
for(int i = 0; i < m_planes.num_elements(); i++)
......@@ -636,11 +640,8 @@ namespace Nektar
PlanesIDs.push_back(m_transposition->GetPlaneID(i));
}
int NumHomoStrip;
m_session->LoadParameter("Strip_Z",NumHomoStrip,1);
// enforce NumHomoDir == 1 by direct call
m_planes[0]->GeneralGetFieldDefinitions(fielddef, 1, HomoBasis,HomoLen,PlanesIDs);
m_planes[0]->GeneralGetFieldDefinitions(fielddef, 1, HomoBasis, HomoLen, StripsIDs, PlanesIDs);
}
......
......@@ -591,7 +591,10 @@ namespace Nektar
int nhom_modes_y = m_homogeneousBasis_y->GetNumModes();
int nhom_modes_z = m_homogeneousBasis_z->GetNumModes();
std::vector<unsigned int> sIDs
= LibUtilities::NullUnsignedIntVector;
std::vector<unsigned int> yIDs;
std::vector<unsigned int> zIDs;
......@@ -605,7 +608,7 @@ namespace Nektar
}
m_lines[0]->GeneralGetFieldDefinitions(returnval, 2, HomoBasis,
HomoLen, zIDs, yIDs);
HomoLen, sIDs, zIDs, yIDs);
return returnval;
}
......@@ -621,7 +624,10 @@ namespace Nektar
int nhom_modes_y = m_homogeneousBasis_y->GetNumModes();
int nhom_modes_z = m_homogeneousBasis_z->GetNumModes();
std::vector<unsigned int> sIDs
=LibUtilities::NullUnsignedIntVector;
std::vector<unsigned int> yIDs;
std::vector<unsigned int> zIDs;
......@@ -635,8 +641,8 @@ namespace Nektar
}
// enforce NumHomoDir == 1 by direct call
m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, HomoBasis,
HomoLen, zIDs, yIDs);
m_lines[0]->GeneralGetFieldDefinitions(fielddef, 2, HomoBasis,
HomoLen, sIDs, zIDs, yIDs);
}
void ExpListHomogeneous2D::v_AppendFieldData(LibUtilities::FieldDefinitionsSharedPtr &fielddef, std::vector<NekDouble> &fielddata, Array<OneD, NekDouble> &coeffs)
......
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