Commit 7b2114ee authored by Jan Eichstaedt's avatar Jan Eichstaedt

updated reference value for varopti test and small adjustments after buildbot

parent a8d151fb
......@@ -148,7 +148,8 @@ IF(NEKTAR_USE_MESHGEN)
ADD_NEKTAR_TEST (MeshGen/cylinder)
ADD_NEKTAR_TEST (MeshGen/sphere)
ADD_NEKTAR_TEST (MeshGen/2d-cad)
ADD_NEKTAR_TEST (MeshGen/2d-naca)
# varopti tests
ADD_NEKTAR_TEST_LENGTHY (MeshGen/varopti_cubesphere)
ADD_NEKTAR_TEST (MeshGen/2d-naca)
ENDIF()
# varopti tests
ADD_NEKTAR_TEST_LENGTHY (MeshGen/varopti_cubesphere)
......@@ -107,22 +107,22 @@ template <> inline void InvTrans<3>(NekDouble in[][3], NekDouble out[][3])
out[2][2] = (in[0][0] * in[1][1] - in[1][0] * in[0][1]) * invdet;
}
/**
* @brief Calculate Scalar product of input vectors.
*/
template<int DIM>
inline NekDouble ScalarProd(NekDouble in1[DIM], NekDouble in2[DIM])
{
return 0.0;
}
template<>
inline NekDouble ScalarProd<2>(NekDouble in1[2], NekDouble in2[2])
template <> inline NekDouble ScalarProd<2>(NekDouble in1[2], NekDouble in2[2])
{
return in1[0] * in2[0]
+ in1[1] * in2[1];
}
template<>
inline NekDouble ScalarProd<3>(NekDouble in1[3], NekDouble in2[3])
template <> inline NekDouble ScalarProd<3>(NekDouble in1[3], NekDouble in2[3])
{
return in1[0] * in2[0]
+ in1[1] * in2[1]
......@@ -177,14 +177,14 @@ template <> inline void EMatrix<3>(NekDouble in[][3], NekDouble out[][3])
* @brief Calculate Frobenius inner product of input matrices.
*/
template<int DIM>
inline NekDouble FrobProd(NekDouble in1[DIM][DIM],
NekDouble in2[DIM][DIM])
inline NekDouble FrobProd(NekDouble in1[][DIM],
NekDouble in2[][DIM])
{
return 0.0;
}
template<>
inline NekDouble FrobProd<2>(NekDouble in1[2][2], NekDouble in2[2][2])
inline NekDouble FrobProd<2>(NekDouble in1[][2], NekDouble in2[][2])
{
return in1[0][0] * in2[0][0]
+ in1[0][1] * in2[0][1]
......@@ -193,7 +193,7 @@ inline NekDouble FrobProd<2>(NekDouble in1[2][2], NekDouble in2[2][2])
}
template<>
inline NekDouble FrobProd<3>(NekDouble in1[3][3], NekDouble in2[3][3])
inline NekDouble FrobProd<3>(NekDouble in1[][3], NekDouble in2[][3])
{
return in1[0][0] * in2[0][0]
+ in1[0][1] * in2[0][1]
......@@ -210,18 +210,6 @@ inline NekDouble FrobProd<3>(NekDouble in1[3][3], NekDouble in2[3][3])
// to functions easily
typedef boost::multi_array<NekDouble, 4> DerivArray;
/**
* @brief Calculate Jacobian matrix \f$ \nabla\phi =
* \nabla\phi_M\nabla\phi_I^{-1} \f$ for each evaluation point of each element.
*
* @param elmt Element to process
* @param point Index of evaluation point
* @param deriv Derivative array containing \f$ \nabla\phi_M \f$
* @param data Data array containing \f$ \nabla\phi_I^{-1} \f$
* @param jacIdeal Output Jacobian matrix
*/
/**
* @brief Calculate Frobenius norm \f$ \| A \|_f ^2 \f$ of a matrix \f$ A \f$.
......@@ -229,13 +217,13 @@ typedef boost::multi_array<NekDouble, 4> DerivArray;
* @param inarray Input matrix \f$ A \f$
*/
template<int DIM>
inline NekDouble FrobeniusNorm(NekDouble inarray[DIM][DIM])
inline NekDouble FrobeniusNorm(NekDouble inarray[][DIM])
{
return 0.0;
}
template<>
inline NekDouble FrobeniusNorm<2>(NekDouble inarray[2][2])
inline NekDouble FrobeniusNorm<2>(NekDouble inarray[][2])
{
return inarray[0][0] * inarray[0][0]
+ inarray[0][1] * inarray[0][1]
......@@ -244,7 +232,7 @@ inline NekDouble FrobeniusNorm<2>(NekDouble inarray[2][2])
}
template<>
inline NekDouble FrobeniusNorm<3>(NekDouble inarray[3][3])
inline NekDouble FrobeniusNorm<3>(NekDouble inarray[][3])
{
return inarray[0][0] * inarray[0][0]
+ inarray[0][1] * inarray[0][1]
......
......@@ -277,10 +277,9 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
//create vector of free nodes which "remain", hence will be included in the coloursets
//vector<NodeSharedPtr> remain_vertex;
vector<NodeSharedPtr> remain_edge;
vector<NodeSharedPtr> remain_face;
vector<NodeSharedPtr> remain_volume;
vector<NodeSharedPtr> remainEdgeVertex;
vector<NodeSharedPtr> remainFace;
vector<NodeSharedPtr> remainVolume;
m_res->nDoF = 0;
// check if vertex nodes are in boundary or ignored nodes, otherwise add to EDGE-VERTEX remain nodes
......@@ -292,7 +291,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
NodeSet::iterator nit3 = ignoredNodes.find(*nit);
if (nit2 == boundaryNodes.end() && nit3 == ignoredNodes.end())
{
remain_edge.push_back(*nit);
remainEdgeVertex.push_back(*nit);
if ((*nit)->GetNumCadCurve() == 1)
{
m_res->nDoF++;
......@@ -308,7 +307,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
}
}
// check if edge nodes are in boundary or ignored nodes, otherwise add to remain nodes
// check if edge nodes are in boundary or ignored nodes, otherwise add to EDGE-VERTEX remain nodes
EdgeSet::iterator eit;
for (eit = m_mesh->m_edgeSet.begin(); eit != m_mesh->m_edgeSet.end(); eit++)
{
......@@ -319,7 +318,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
NodeSet::iterator nit3 = ignoredNodes.find(n[j]);
if (nit2 == boundaryNodes.end() && nit3 == ignoredNodes.end())
{
remain_edge.push_back(n[j]);
remainEdgeVertex.push_back(n[j]);
if (n[j]->GetNumCadCurve() == 1)
{
m_res->nDoF++;
......@@ -336,7 +335,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
}
}
// check if face nodes are in boundary or ignored nodes, otherwise add to remain nodes
// check if face nodes are in boundary or ignored nodes, otherwise add to FACE remain nodes
FaceSet::iterator fit;
for (fit = m_mesh->m_faceSet.begin(); fit != m_mesh->m_faceSet.end(); fit++)
{
......@@ -346,7 +345,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
NodeSet::iterator nit3 = ignoredNodes.find((*fit)->m_faceNodes[j]);
if (nit2 == boundaryNodes.end() && nit3 == ignoredNodes.end())
{
remain_face.push_back((*fit)->m_faceNodes[j]);
remainFace.push_back((*fit)->m_faceNodes[j]);
if ((*fit)->m_faceNodes[j]->GetNumCADSurf() == 1)
{
m_res->nDoF += 2;
......@@ -359,7 +358,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
}
}
// check if volume nodes are in boundary or ignored nodes, otherwise add to remain nodes
// check if volume nodes are in boundary or ignored nodes, otherwise add to VOLUME remain nodes
for (int i = 0; i < m_mesh->m_element[m_mesh->m_expDim].size(); i++)
{
vector<NodeSharedPtr> ns =
......@@ -370,90 +369,78 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
NodeSet::iterator nit3 = ignoredNodes.find(ns[j]);
if (nit2 == boundaryNodes.end() && nit3 == ignoredNodes.end())
{
remain_volume.push_back(ns[j]);
remainVolume.push_back(ns[j]);
m_res->nDoF += m_mesh->m_spaceDim;
}
}
}
// size of all free nodes to be included in the coloursets
m_res->n = remain_edge.size() // + remain_vertex.size()
+ remain_face.size() + remain_volume.size();
m_res->n = remainEdgeVertex.size()
+ remainFace.size() + remainVolume.size();
// data structure for coloursets, that will ultimately contain all free nodes
vector<vector<NodeSharedPtr> > ret;
vector<vector<NodeSharedPtr> > ret_part;
vector<vector<NodeSharedPtr> > retPart;
// edge and vertex nodes
// edge and vertex nodes
// create vector num_el of number of associated elements of each node
vector<int> num_el(remain_edge.size());
for (int i = 0; i < remain_edge.size(); i++)
vector<int> num_el(remainEdgeVertex.size());
for (int i = 0; i < remainEdgeVertex.size(); i++)
{
NodeElMap::iterator it = m_nodeElMap.find(remain_edge[i]->m_id); //try to find node within all elements
//try to find node within all elements
NodeElMap::iterator it = m_nodeElMap.find(remainEdgeVertex[i]->m_id);
vector<ElUtilSharedPtr> &elUtils = it->second;
num_el[i] = elUtils.size();
}
// finding the permutation according to num_el
vector<int> perm_node(remain_edge.size());
for (int i = 0; i < remain_edge.size(); ++i)
vector<int> permNode(remainEdgeVertex.size());
for (int i = 0; i < remainEdgeVertex.size(); ++i)
{
perm_node[i] = i;
permNode[i] = i;
}
//std::sort(perm_node.begin(),perm_node.end(),[&] (int j, int k){return (num_el[j] > num_el[k]); }); // sort in descending order
std::sort(perm_node.begin(), perm_node.end(), NodeComparator(num_el));
// applying the permutation to remain_edge
vector<NodeSharedPtr> remain_edge_sort(remain_edge.size());
//std::transform(perm_node.begin(), perm_node.end(), remain_edge_sort.begin(),[&](int i){ return remain_edge[i]; });
for (int i = 0; i < remain_edge.size(); ++i)
std::sort(permNode.begin(), permNode.end(), NodeComparator(num_el));
// applying the permutation to remainEdgeVertex
vector<NodeSharedPtr> remainEdgeVertexSort(remainEdgeVertex.size());
for (int i = 0; i < remainEdgeVertex.size(); ++i)
{
int j = perm_node[i];
remain_edge_sort[i] = remain_edge[j];
int j = permNode[i];
remainEdgeVertexSort[i] = remainEdgeVertex[j];
}
ret_part = CreateColoursets(remain_edge_sort);
retPart = CreateColoursets(remainEdgeVertexSort);
if(m_mesh->m_verbose)
{
printf("\nNumber of Edge/Vertex Coloursets: %i\n", ret_part.size());
printf("\nNumber of Edge/Vertex Coloursets: %i\n", retPart.size());
}
for (int i = 0; i < ret_part.size(); i++)
for (int i = 0; i < retPart.size(); i++)
{
if(m_mesh->m_verbose)
{
printf("Size of Edge/Vertex-Colourset %i: %i\n", i, ret_part[i].size());
}
ret.push_back(ret_part[i]);
ret.push_back(retPart[i]);
}
// face nodes
ret_part = CreateColoursets(remain_face);
// face nodes
retPart = CreateColoursets(remainFace);
if(m_mesh->m_verbose)
{
printf("\nNumber of Face Coloursets: %i\n" ,ret_part.size());
printf("\nNumber of Face Coloursets: %i\n" ,retPart.size());
}
for (int i = 0; i < ret_part.size(); i++)
for (int i = 0; i < retPart.size(); i++)
{
if(m_mesh->m_verbose)
{
printf("Size of Face-Colourset %i: %i\n", i, ret_part[i].size());
}
ret.push_back(ret_part[i]);
ret.push_back(retPart[i]);
}
// volume nodes
ret_part = CreateColoursets(remain_volume);
// volume nodes
retPart = CreateColoursets(remainVolume);
if(m_mesh->m_verbose)
{
printf("\nNumber of Volume Coloursets: %i\n", ret_part.size());
printf("\nNumber of Volume Coloursets: %i\n", retPart.size());
}
for (int i = 0; i < ret_part.size(); i++)
for (int i = 0; i < retPart.size(); i++)
{
if(m_mesh->m_verbose)
{
printf("Size of Volume-Colourset %i: %i\n", i, ret_part[i].size());
}
ret.push_back(ret_part[i]);
ret.push_back(retPart[i]);
}
......@@ -468,7 +455,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::GetColouredNodes(
vector<vector<NodeSharedPtr> > ProcessVarOpti::CreateColoursets(
vector<NodeSharedPtr> remain)
{
vector<vector<NodeSharedPtr> > ret_part;
vector<vector<NodeSharedPtr> > retPart;
// loop until all free nodes have been sorted
while (remain.size() > 0)
......@@ -517,7 +504,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::CreateColoursets(
}
// include layer or colourset into vector of coloursets
ret_part.push_back(layer);
retPart.push_back(layer);
// print out progress
if(m_mesh->m_verbose)
......@@ -526,7 +513,7 @@ vector<vector<NodeSharedPtr> > ProcessVarOpti::CreateColoursets(
}
}
return ret_part;
return retPart;
}
......
......@@ -11,7 +11,7 @@
<regex>Worst at end: (-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)</regex>
<matches>
<match>
<field id="0" tolerance="5e-2">7.563667e-01</field>
<field id="0" tolerance="5e-2">7.042539e-01</field>
</match>
</matches>
</metric>
......
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