Commit 2abd76b8 authored by Dave Moxey's avatar Dave Moxey
Browse files

Fix OS X warning with clang, refactor weighting function slightly to remove...

Fix OS X warning with clang, refactor weighting function slightly to remove commented out lines and code duplication
parent 63268e29
......@@ -92,7 +92,10 @@ namespace Nektar
"Too few elements for this many processes.");
m_shared = shared;
if (m_weightingRequired) WeightElements();
if (m_weightingRequired)
{
WeightElements();
}
CreateGraph(m_mesh);
PartitionGraph(m_mesh, nParts, m_localPartition);
}
......@@ -518,45 +521,10 @@ namespace Nektar
nc = it->second[2];
}
int weight = 0;
int bndWeight = 0;
switch (m_meshComposites[cId].type)
{
case 'A':
weight = StdTetData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdTetData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'R':
weight = StdPrismData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdPrismData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'H':
weight = StdHexData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdHexData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'P':
weight = StdPyrData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdPyrData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'Q':
weight = StdQuadData::getNumberOfCoefficients(na, nb);
bndWeight = StdQuadData::getNumberOfBndCoefficients(na, nb);
break;
case 'T':
weight = StdTriData::getNumberOfCoefficients(na, nb);
bndWeight = StdTriData::getNumberOfBndCoefficients(na, nb);
break;
case 'S':
weight = StdSegData::getNumberOfCoefficients(na);
bndWeight = StdSegData::getNumberOfBndCoefficients(na);
break;
case 'V':
weight = 1;
bndWeight = 1;
break;
default:
break;
}
int weight = CalculateElementWeight(
m_meshComposites[cId].type, false, na, nb, nc);
int bndWeight = CalculateElementWeight(
m_meshComposites[cId].type, true, na, nb, nc);
for (unsigned int j = 0; j < m_meshComposites[cId].list.size(); ++j)
{
......@@ -686,51 +654,13 @@ namespace Nektar
nc = it->second[2];
}
//int weight = 0;
int bndWeight = 0;
switch (m_meshComposites[cId].type)
{
case 'A':
//weight = StdTetData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdTetData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'R':
//weight = StdPrismData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdPrismData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'H':
//weight = StdHexData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdHexData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'P':
//weight = StdPyrData::getNumberOfCoefficients(na, nb, nc);
bndWeight = StdPyrData::getNumberOfBndCoefficients(na, nb, nc);
break;
case 'Q':
//weight = StdQuadData::getNumberOfCoefficients(na, nb);
bndWeight = StdQuadData::getNumberOfBndCoefficients(na, nb);
break;
case 'T':
//weight = StdTriData::getNumberOfCoefficients(na, nb);
bndWeight = StdTriData::getNumberOfBndCoefficients(na, nb);
break;
case 'S':
//weight = StdSegData::getNumberOfCoefficients(na);
bndWeight = StdSegData::getNumberOfBndCoefficients(na);
break;
case 'V':
//weight = 1;
bndWeight = 1;
break;
default:
break;
}
int bndWeight = CalculateElementWeight(
m_meshComposites[cId].type, true, na, nb, nc);
for (unsigned int j = 0; j < m_meshComposites[cId].list.size(); ++j)
{
int elmtId = m_meshComposites[cId].list[j];
m_vertWeights[elmtId][ m_fieldNameToId[it->first]] = bndWeight;
//m_vertWeights[elmtId][ m_fieldNameToId[ it->first ] * 2 + 1 ] = weight*weight;
m_vertWeights[elmtId][m_fieldNameToId[it->first]] = bndWeight;
}
}
} // for i
......@@ -1334,5 +1264,61 @@ namespace Nektar
elmtid.push_back(m_meshElements[m_localPartition[procid][*vertit].id].id);
}
}
int MeshPartition::CalculateElementWeight(
char elmtType,
bool bndWeight,
int na,
int nb,
int nc)
{
int weight = 0;
switch (elmtType)
{
case 'A':
weight = bndWeight ?
StdTetData ::getNumberOfBndCoefficients(na, nb, nc) :
StdTetData ::getNumberOfCoefficients (na, nb, nc);
break;
case 'R':
weight = bndWeight ?
StdPrismData::getNumberOfBndCoefficients(na, nb, nc) :
StdPrismData::getNumberOfCoefficients (na, nb, nc);
break;
case 'H':
weight = bndWeight ?
StdHexData ::getNumberOfBndCoefficients(na, nb, nc) :
StdHexData ::getNumberOfCoefficients (na, nb, nc);
break;
case 'P':
weight = bndWeight ?
StdPyrData ::getNumberOfBndCoefficients(na, nb, nc) :
StdPyrData ::getNumberOfCoefficients (na, nb, nc);
break;
case 'Q':
weight = bndWeight ?
StdQuadData ::getNumberOfBndCoefficients(na, nb) :
StdQuadData ::getNumberOfCoefficients (na, nb);
break;
case 'T':
weight = bndWeight ?
StdTriData ::getNumberOfBndCoefficients(na, nb) :
StdTriData ::getNumberOfCoefficients (na, nb);
break;
case 'S':
weight = bndWeight ?
StdSegData ::getNumberOfBndCoefficients(na) :
StdSegData ::getNumberOfCoefficients (na);
break;
case 'V':
weight = 1;
break;
default:
break;
}
return weight;
}
}
}
......@@ -239,6 +239,7 @@ namespace Nektar
void OutputPartition(SessionReaderSharedPtr& pSession, BoostSubGraph& pGraph, TiXmlElement* pGeometry);
void CheckPartitions(int nParts, Array<OneD, int> &pPart);
int CalculateElementWeight(char elmtType, bool bndWeight, int na, int nb, int nc);
};
typedef boost::shared_ptr<MeshPartition> MeshPartitionSharedPtr;
......
......@@ -65,8 +65,8 @@ NoAdvection::~NoAdvection()
*
*/
void NoAdvection::v_InitObject(
const LibUtilities::SessionReaderSharedPtr &pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr> &pFields)
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields)
{
}
......
......@@ -62,8 +62,8 @@ protected:
virtual ~NoAdvection();
virtual void v_InitObject(
const LibUtilities::SessionReaderSharedPtr &pSession,
const Array<OneD, MultiRegions::ExpListSharedPtr> &pFields);
LibUtilities::SessionReaderSharedPtr pSession,
Array<OneD, MultiRegions::ExpListSharedPtr> pFields);
virtual void v_Advect(
const int nConvectiveFields,
......
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