From a2a0ecd6f67b62591a9fe443421f6098674ac53f Mon Sep 17 00:00:00 2001 From: Christophe Geuzaine Date: Fri, 29 Nov 2019 08:25:39 +0100 Subject: [PATCH] fix non-deterministic ordering of unknowns in linear system (which leads to slightly different residuals) --- .../HighOrderMeshElasticAnalogy.cpp | 18 +++++++++--------- .../HighOrderMeshElasticAnalogy.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.cpp b/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.cpp index 4c6a5634c..fc26075ab 100644 --- a/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.cpp +++ b/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.cpp @@ -180,7 +180,7 @@ static void addOneLayer(const std::vector &v, std::vector &d, std::vector &layer) { - std::set all; + std::set all; for(std::size_t i = 0; i < d.size(); i++) { MElement *e = d[i]; int n = e->getNumPrimaryVertices(); @@ -308,8 +308,8 @@ void highOrderTools::applySmoothingTo(std::vector &all, GFace *gf) gf->tag(), v.size(), minD, numBad); addOneLayer(all, v, layer); - std::set::iterator it; - std::set verticesToMove; + std::set::iterator it; + std::set verticesToMove; // on the last layer, fix displacement to 0 for(std::size_t i = 0; i < layer.size(); i++) { @@ -377,10 +377,10 @@ void highOrderTools::applySmoothingTo(std::vector &all, GFace *gf) double highOrderTools::_smoothMetric(std::vector &v, GFace *gf, dofManager &myAssembler, - std::set &verticesToMove, + std::set &verticesToMove, elasticityTerm &El) { - std::set::iterator it; + std::set::iterator it; double dx = 0.0; if(myAssembler.sizeOfR()) { @@ -624,7 +624,7 @@ double highOrderTools::_applyIncrementalDisplacement( elasticityMixedTerm El_mixed(0, 1.0, .333, _tag); elasticityTerm El(0, 1.0, .333, _tag); - std::set _vertices; + std::set _vertices; // Boundary Conditions & Numbering @@ -646,7 +646,7 @@ double highOrderTools::_applyIncrementalDisplacement( } } - for(std::set::iterator it = _vertices.begin(); + for(std::set::iterator it = _vertices.begin(); it != _vertices.end(); ++it) { MVertex *vert = *it; std::map::iterator itt = _targetLocation.find(vert); @@ -692,7 +692,7 @@ double highOrderTools::_applyIncrementalDisplacement( //fprintf(fd, "$MeshFormat\n2 0 8\n$EndMeshFormat\n$NodeData\n1\n" // "\"tr(sigma)\"\n1\n0.0\n3\n1\n3\n%d\n", // (int)_vertices.size()); - for(std::set::iterator it = _vertices.begin(); + for(std::set::iterator it = _vertices.begin(); it != _vertices.end(); ++it) { double ax, ay, az; myAssembler.getDofValue(*it, 0, _tag, ax); @@ -717,7 +717,7 @@ double highOrderTools::_applyIncrementalDisplacement( getDistordedElements(v, 0.5, disto, minD); if(minD < thres) { percentage -= 10.; - for(std::set::iterator it = _vertices.begin(); + for(std::set::iterator it = _vertices.begin(); it != _vertices.end(); ++it) { double ax, ay, az; myAssembler.getDofValue(*it, 0, _tag, ax); diff --git a/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.h b/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.h index 29f4ed65d..f7d5d368b 100644 --- a/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.h +++ b/contrib/HighOrderMeshOptimizer/HighOrderMeshElasticAnalogy.h @@ -59,7 +59,7 @@ class highOrderTools { } double _smoothMetric(std::vector &v, GFace *gf, dofManager &myAssembler, - std::set &verticesToMove, + std::set &verticesToMove, elasticityTerm &El); void _computeMetricInfo(GFace *gf, MElement *e, fullMatrix &J, fullMatrix &JT, fullVector &D);