From f84e886dfb94c43a6591dab1c5fc464754753b8c Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Sat, 1 Dec 2018 05:47:08 +0100 Subject: [PATCH 1/8] Fix for GCC 8.2.0 --- ugbase/lib_disc/function_spaces/local_transfer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ugbase/lib_disc/function_spaces/local_transfer.h b/ugbase/lib_disc/function_spaces/local_transfer.h index 7550ce201..e93795cb5 100644 --- a/ugbase/lib_disc/function_spaces/local_transfer.h +++ b/ugbase/lib_disc/function_spaces/local_transfer.h @@ -411,8 +411,8 @@ class CrouzeixRaviartElemTransfer return false; } - // the following line silences -Woverloaded-virtual - using ElemProlongationBase >::prolongate; + // the following line silences -Woverloaded-virtual and makes GCC 8.2.0 fail + // using ElemProlongationBase >::prolongate; void prolongate(Vertex* parent, TransferValueAccessor& vValueChild, TransferValueAccessor& vValueParent) From d4fb06f8f89bb381521c4d20a4d81b2344aabc76 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Sat, 1 Dec 2018 19:08:12 +0100 Subject: [PATCH 2/8] Fix for GCC 8.2.0 --- ugbase/lib_disc/function_spaces/local_transfer.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ugbase/lib_disc/function_spaces/local_transfer.h b/ugbase/lib_disc/function_spaces/local_transfer.h index e93795cb5..7aa08e662 100644 --- a/ugbase/lib_disc/function_spaces/local_transfer.h +++ b/ugbase/lib_disc/function_spaces/local_transfer.h @@ -522,7 +522,7 @@ class CrouzeixRaviartElemTransfer vParentElem[p] = vElem[p]; // call prolongation - prolongate(vParentElem, vChildSide, vValueChild, vValueParent); + this->template prolongate(vParentElem, vChildSide, vValueChild, vValueParent); } // b) prolongation from a element @@ -544,7 +544,7 @@ class CrouzeixRaviartElemTransfer vParentElem[0] = parent; // call prolongation - prolongate(vParentElem, vChildSide, vValueChild, vValueParent); + this->template prolongate(vParentElem, vChildSide, vValueChild, vValueParent); } }; From 79953055ab251eb7a3142749a10123699d496568 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Wed, 7 Aug 2019 10:44:48 +0200 Subject: [PATCH 3/8] Fix (jlong->jstring). --- ugbase/bindings/vrl/bindings_vrl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ugbase/bindings/vrl/bindings_vrl.cpp b/ugbase/bindings/vrl/bindings_vrl.cpp index 6cff5f765..fd8bb8116 100644 --- a/ugbase/bindings/vrl/bindings_vrl.cpp +++ b/ugbase/bindings/vrl/bindings_vrl.cpp @@ -444,7 +444,7 @@ JNIEXPORT jstring JNICALL Java_edu_gcsc_vrl_ug_UG__1getDefaultClassNameFromGroup ug::vrl::throwUgErrorAsJavaException(env, ss.str()); } - return (jlong) NULL; + return (jstring) NULL; } JNIEXPORT jstring JNICALL Java_edu_gcsc_vrl_ug_UG__1getSvnRevision(JNIEnv *env, From 1c6e419b064b17ac2e5a24bb6279083f37bd1d53 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Wed, 6 Nov 2019 15:05:02 +0100 Subject: [PATCH 4/8] Adding subset info to CheckUnconnectedSides. --- scripts/util/domain_util.lua | 4 +- .../bridge/domain_bridges/domain_bridge.cpp | 5 +++ ugbase/bridge/grid_bridges/debug_bridge.cpp | 38 ++++++++----------- ugbase/lib_grid/algorithms/debug_util.cpp | 7 ++++ ugbase/lib_grid/algorithms/debug_util.h | 8 ++++ .../algorithms/problem_detection_util.cpp | 25 ++++++++---- .../algorithms/problem_detection_util.h | 3 +- 7 files changed, 57 insertions(+), 33 deletions(-) diff --git a/scripts/util/domain_util.lua b/scripts/util/domain_util.lua index 42f9e677d..cfdaa178a 100644 --- a/scripts/util/domain_util.lua +++ b/scripts/util/domain_util.lua @@ -83,7 +83,7 @@ function util.CreateDomain(gridName, numRefs, neededSubsets, noIntegrityCheck) if noIntegrityCheck ~= true then write("Performing integrity check on domain ... ") - if CheckForUnconnectedSides(dom:grid()) == true then + if CheckForUnconnectedSides(dom) == true then write("WARNING: unconnected sides found (see above).\n") local note = "NOTE: You may disable this check by passing 'true' ".. "to 'noIntegrityCheck' in 'util.CreateDomain'.\n" @@ -178,7 +178,7 @@ function util.CreateAndDistributeDomain(gridName, numRefs, numPreRefs, if noIntegrityCheck ~= true then write("Performing integrity check on domain ... ") - if CheckForUnconnectedSides(dom:grid()) == true then + if CheckForUnconnectedSides(dom) == true then write("WARNING: unconnected sides found (see above).\n") local note = "NOTE: You may disable this check by passing 'true' ".. "to 'noIntegrityCheck' in 'util.CreateAndDistributeDomain'.\n" diff --git a/ugbase/bridge/domain_bridges/domain_bridge.cpp b/ugbase/bridge/domain_bridges/domain_bridge.cpp index 0b47708c4..d414d897b 100644 --- a/ugbase/bridge/domain_bridges/domain_bridge.cpp +++ b/ugbase/bridge/domain_bridges/domain_bridge.cpp @@ -62,6 +62,7 @@ #endif +#include "lib_grid/algorithms/problem_detection_util.h" using namespace std; namespace ug{ @@ -439,6 +440,10 @@ static void Domain(Registry& reg, string grp) reg.add_class_to_group(name, "Domain", tag); } +// CheckForUnconnectedSides + reg.add_function("CheckForUnconnectedSides", static_cast (&CheckForUnconnectedSides), + grp, "foundUnconnectedSides", "domain", "Checks whether unconnected sides exist in the given grid."); + // MaxElementDiameter reg.add_function("MaxElementDiameter", static_cast( diff --git a/ugbase/bridge/grid_bridges/debug_bridge.cpp b/ugbase/bridge/grid_bridges/debug_bridge.cpp index 7cdfd16f5..32030bcfd 100644 --- a/ugbase/bridge/grid_bridges/debug_bridge.cpp +++ b/ugbase/bridge/grid_bridges/debug_bridge.cpp @@ -33,28 +33,22 @@ #include "grid_bridges.h" #include "lib_grid/algorithms/debug_util.h" #include "lib_grid/algorithms/problem_detection_util.h" +#include "../util_domain_dependent.h" +#include "bridge/util.h" using namespace std; -namespace ug{ -namespace bridge{ - -void RegisterGridBridge_Debug(Registry& reg, string parentGroup) -{ - string grp = parentGroup; - - reg.add_function("CheckHangingNodeConsistency", static_cast(&CheckHangingNodeConsistency), grp) - .add_function("CheckMultiGridConsistency", &CheckMultiGridConsistency, grp) - .add_function("CheckDistributedObjectConstraintTypes", &CheckDistributedObjectConstraintTypes, grp) - .add_function("CheckDistributedParentTypes", &CheckDistributedParentTypes, grp) - .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp) - .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp) - .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp); - - reg.add_function("CheckForUnconnectedSides", &CheckForUnconnectedSides, - grp, "foundUnconnectedSides", "grid", - "Checks whether unconnected sides exist in the given grid."); -} - -}// end of namespace -}// end of namespace +namespace ug { + namespace bridge { + void RegisterGridBridge_Debug(Registry& reg, string grp) + { + reg.add_function("CheckHangingNodeConsistency", static_cast(&CheckHangingNodeConsistency), grp) + .add_function("CheckMultiGridConsistency", &CheckMultiGridConsistency, grp) + .add_function("CheckDistributedObjectConstraintTypes", &CheckDistributedObjectConstraintTypes, grp) + .add_function("CheckDistributedParentTypes", &CheckDistributedParentTypes, grp) + .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp) + .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp) + .add_function("CheckElementConsistency", static_cast(&CheckElementConsistency), grp); + } + }// end of namespace bridge +}// end of namespace ug diff --git a/ugbase/lib_grid/algorithms/debug_util.cpp b/ugbase/lib_grid/algorithms/debug_util.cpp index d35417136..b3e3751c7 100644 --- a/ugbase/lib_grid/algorithms/debug_util.cpp +++ b/ugbase/lib_grid/algorithms/debug_util.cpp @@ -988,6 +988,13 @@ std::string ElementDebugInfo_IMPL(const Grid& grid, TElem* e) return ss.str(); } +std::string ElementSubsetInfo(const ISubsetHandler& sh, GridObject* e) { + std::stringstream ss; + int si = sh.get_subset_index(e); + ss << "Element in subset with index " << si << " and name " << sh.get_subset_name(si); + return ss.str(); +} + std::string ElementDebugInfo(const Grid& grid, GridObject* e) { switch(e->base_object_id()){ diff --git a/ugbase/lib_grid/algorithms/debug_util.h b/ugbase/lib_grid/algorithms/debug_util.h index 722ef52ef..1a0f2aa98 100644 --- a/ugbase/lib_grid/algorithms/debug_util.h +++ b/ugbase/lib_grid/algorithms/debug_util.h @@ -145,6 +145,14 @@ bool CheckElementConsistency(MultiGrid& mg, Face* f); std::string ElementDebugInfo(const Grid& grid, GridObject* e); /** \} */ +/// Returns a string containing information on the given element +/** The string contains the subset index and name of the element + * \return string containing information + * + * \{ */ +std::string ElementSubsetInfo(const ISubsetHandler& grid, GridObject* e); +/** \} */ + /// Performs some tests on a surface-view (checks iterators vs surface-states) //void CheckSurfaceViewConsistency(SurfaceView& sv); diff --git a/ugbase/lib_grid/algorithms/problem_detection_util.cpp b/ugbase/lib_grid/algorithms/problem_detection_util.cpp index 079321fd7..614ea7846 100644 --- a/ugbase/lib_grid/algorithms/problem_detection_util.cpp +++ b/ugbase/lib_grid/algorithms/problem_detection_util.cpp @@ -36,6 +36,7 @@ #include "lib_grid/grid/grid.h" #include "debug_util.h" #include "isolated_elements.h" +#include "lib_disc/domain.h" namespace ug{ @@ -67,14 +68,14 @@ int IsSliver(const vector3& v0, const vector3& v1, const vector3& v2, template -static bool CheckForUnconnectedSidesIMPL(Grid& grid) +static bool CheckForUnconnectedSidesIMPL(Grid& grid, const ISubsetHandler& sh) { bool gotOne = false; std::vector sides; - if( CollectUnconnectedSides( sides, + if(CollectUnconnectedSides(sides, grid, - grid.begin(), - grid.end())) + grid.template begin(), + grid.template end())) { gotOne = true; UG_LOG("WARNING: Found unconnected sides (those may lead to solver issues!): \n"); @@ -82,20 +83,28 @@ static bool CheckForUnconnectedSidesIMPL(Grid& grid) for(size_t i = 0; i < sides.size(); ++i){ UG_LOG(" - " << ElementDebugInfo(grid, sides[i]) << std::endl); UG_ERR_LOG(" - " << ElementDebugInfo(grid, sides[i]) << std::endl); + UG_LOG(" - " << ElementSubsetInfo(sh, sides[i]) << std::endl); + UG_ERR_LOG(" - " << ElementSubsetInfo(sh, sides[i]) << std::endl); } } return gotOne; } -bool CheckForUnconnectedSides(Grid& grid) +template +bool CheckForUnconnectedSides(TDomain& dom) { - if(grid.num() > 0 && CheckForUnconnectedSidesIMPL(grid)) + if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) return true; - if(grid.num() > 0 && CheckForUnconnectedSidesIMPL(grid)) + if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) return true; - if(grid.num() > 0 && CheckForUnconnectedSidesIMPL(grid)) + if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) return true; return false; } +/// explicit template instantiations +template bool CheckForUnconnectedSides(Domain1d& domain); +template bool CheckForUnconnectedSides(Domain2d& domain); +template bool CheckForUnconnectedSides(Domain3d& domain); + }// end of namespace diff --git a/ugbase/lib_grid/algorithms/problem_detection_util.h b/ugbase/lib_grid/algorithms/problem_detection_util.h index 96b8fd9f2..b7b200b34 100644 --- a/ugbase/lib_grid/algorithms/problem_detection_util.h +++ b/ugbase/lib_grid/algorithms/problem_detection_util.h @@ -56,7 +56,8 @@ size_t FindSlivers(std::vector& sliversOut, TAAPos aaPos, bool clearContainer = true); /// Logs all unconnected sides to UG_ERR_LOG and returns true if an unconnected side was found -bool CheckForUnconnectedSides(Grid& grid); +template +bool CheckForUnconnectedSides(TDomain& dom); }// end of namespace From 1d00e18b10d2ad08c5c0480fde6fb0eb159aef75 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Wed, 6 Nov 2019 15:29:34 +0100 Subject: [PATCH 5/8] Adding count of unconnected sides. --- ugbase/lib_grid/algorithms/problem_detection_util.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ugbase/lib_grid/algorithms/problem_detection_util.cpp b/ugbase/lib_grid/algorithms/problem_detection_util.cpp index 614ea7846..daf917305 100644 --- a/ugbase/lib_grid/algorithms/problem_detection_util.cpp +++ b/ugbase/lib_grid/algorithms/problem_detection_util.cpp @@ -78,9 +78,10 @@ static bool CheckForUnconnectedSidesIMPL(Grid& grid, const ISubsetHandler& sh) grid.template end())) { gotOne = true; - UG_LOG("WARNING: Found unconnected sides (those may lead to solver issues!): \n"); - UG_ERR_LOG("Found unconnected sides (those may lead to solver issues!): \n"); - for(size_t i = 0; i < sides.size(); ++i){ + const size_t numSides = sides.size(); + UG_LOG("WARNING: Found " << numSides << " unconnected sides (those may lead to solver issues!):" << std::endl); + UG_ERR_LOG("Found " << numSides << " unconnected sides (those may lead to solver issues!):" << std::endl); + for(size_t i = 0; i < numSides; ++i){ UG_LOG(" - " << ElementDebugInfo(grid, sides[i]) << std::endl); UG_ERR_LOG(" - " << ElementDebugInfo(grid, sides[i]) << std::endl); UG_LOG(" - " << ElementSubsetInfo(sh, sides[i]) << std::endl); From 07850d9aac287cfe977fea3d7f5c982946bcf2a3 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Thu, 7 Nov 2019 11:05:36 +0100 Subject: [PATCH 6/8] Improving CheckForUnconnectedSides function. The function checks for unconnected sides of base element types in a grid, i.e. Edge, Face, Volume. Previously however, if the function found unconnected sides of a given type, e.g. unconnected Edge elements, only all unconnected Edge elements would be printed and the function returned, ignoring to check other relevant element types, e.g. Face and Volume for unconnected sides. This hid other unconnected sides of other element type from the user. The function now does not return and prints debug information for unconnected sides for the three base element types. --- .../algorithms/problem_detection_util.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/ugbase/lib_grid/algorithms/problem_detection_util.cpp b/ugbase/lib_grid/algorithms/problem_detection_util.cpp index daf917305..d60dc4a84 100644 --- a/ugbase/lib_grid/algorithms/problem_detection_util.cpp +++ b/ugbase/lib_grid/algorithms/problem_detection_util.cpp @@ -94,13 +94,14 @@ static bool CheckForUnconnectedSidesIMPL(Grid& grid, const ISubsetHandler& sh) template bool CheckForUnconnectedSides(TDomain& dom) { - if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) - return true; - if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) - return true; - if(dom.grid().get()->template num() > 0 && CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get())) - return true; - return false; + bool foundUnconnectedElements = false; + if (dom.grid().get()->template num() > 0) + foundUnconnectedElements = foundUnconnectedElements || CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get()); + if(dom.grid().get()->template num() > 0) + foundUnconnectedElements = foundUnconnectedElements || CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get()); + if(dom.grid().get()->template num() > 0) + foundUnconnectedElements = foundUnconnectedElements || CheckForUnconnectedSidesIMPL(*dom.grid().get(), *dom.subset_handler().get()); + return foundUnconnectedElements; } /// explicit template instantiations From cac22108c8cbee0dca6ffab356a3b9621e7fabd7 Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Mon, 17 Aug 2020 16:08:30 +0200 Subject: [PATCH 7/8] Update .travis.yml --- .travis.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69fe1ddd3..d76b8c6a0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -100,4 +100,10 @@ script: # we still need to use travis_wait to prevent "build error because of no output" # https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received - travis_wait 45 make -j2 - - if [[ "$TARGET" == "ugshell" ]]; then ../bin/ugshell -call "print(\"it works\")"; fi + - if [[ "$TARGET" == "ugshell" ]]; then ../bin/ugshell -call "print(\"it works\")"; fi + - curl -LO https://raw.github.com/stephanmg/travis-dependent-builds/master/trigger.sh + - chmod +x trigger.sh + - ./trigger.sh NeuroBox3D ProMeshScripts master $TRAVIS_ACCESS_TOKEN "" + +after_script: + - echo "Triggered downstream projects: NeuroBox3D/ProMeshScripts" From 498e45b64dac70cfc7768fcd2620ef65ce4dcb3f Mon Sep 17 00:00:00 2001 From: Stephan Grein Date: Wed, 16 Sep 2020 09:58:35 +0200 Subject: [PATCH 8/8] Fix for segmentation fault in adaptive refinement Presumably introduced by commit 7fda4c2380461d396a3e171453deaa99e5baeb74. --- ugbase/lib_disc/function_spaces/error_elem_marking_strategy.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ugbase/lib_disc/function_spaces/error_elem_marking_strategy.h b/ugbase/lib_disc/function_spaces/error_elem_marking_strategy.h index 9dd2f04b9..ca3c31c02 100644 --- a/ugbase/lib_disc/function_spaces/error_elem_marking_strategy.h +++ b/ugbase/lib_disc/function_spaces/error_elem_marking_strategy.h @@ -74,7 +74,7 @@ class IMultigridElementIndicators { typedef typename domain_traits::element_type elem_type; - if (!m_pMG->has_attachment(m_aError)) + if (!pMG->has_attachment(m_aError)) pMG->template attach_to_dv(m_aError, -1.0); // attach with default value m_pMG = pMG; m_aaError = attachment_accessor_type(*m_pMG, m_aError);