From 2d0a82fd32b99ff2a540d18f584842eb572a9bb7 Mon Sep 17 00:00:00 2001 From: Thomas-TK Date: Mon, 3 Dec 2018 11:05:10 +0100 Subject: [PATCH 1/4] unsafe delete for unconfined benchmark new: memory for array for maximum size. --- MSH/msh_lib.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/MSH/msh_lib.cpp b/MSH/msh_lib.cpp index 00904d30d..0609f97d4 100644 --- a/MSH/msh_lib.cpp +++ b/MSH/msh_lib.cpp @@ -911,7 +911,7 @@ void MSHSelectFreeSurfaceNodes(MeshLib::CFEMesh* m_msh) size_t NumberOfNodesPerLayer = m_msh->nod_vector.size() / (m_msh->getNumberOfMeshLayers() + 1); size_t no_unconfined_layer = 0; // create array with nodes in vertical column - size_t* strang(new size_t[m_msh->getNumberOfMeshLayers()]); + size_t* strang(new size_t[m_msh->getNumberOfMeshLayers()*2]); for (size_t i = 0; i < NumberOfNodesPerLayer; i++) { if (m_msh->nod_vector[i]->free_surface == 4) @@ -926,6 +926,7 @@ void MSHSelectFreeSurfaceNodes(MeshLib::CFEMesh* m_msh) nextnode = MSHGetNextNode(startnode, m_msh); if (m_msh->nod_vector[nextnode]->free_surface == 4) { + strang[j + 1] = nextnode; no_unconfined_layer++; } From 5c1ec203cfcde7bd006bccdff507590c0fca1424 Mon Sep 17 00:00:00 2001 From: Thomas-TK Date: Mon, 3 Dec 2018 11:07:36 +0100 Subject: [PATCH 2/4] unsafe delete for unconfined benchmark new: memory for array for maximum size. --- MSH/msh_lib.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/MSH/msh_lib.cpp b/MSH/msh_lib.cpp index 0609f97d4..9bc1fc215 100644 --- a/MSH/msh_lib.cpp +++ b/MSH/msh_lib.cpp @@ -926,7 +926,6 @@ void MSHSelectFreeSurfaceNodes(MeshLib::CFEMesh* m_msh) nextnode = MSHGetNextNode(startnode, m_msh); if (m_msh->nod_vector[nextnode]->free_surface == 4) { - strang[j + 1] = nextnode; no_unconfined_layer++; } From 4dcd7a6f99ae032978449a20127bca2e65a52b9c Mon Sep 17 00:00:00 2001 From: Thomas-TK Date: Mon, 3 Dec 2018 11:57:53 +0100 Subject: [PATCH 3/4] Allow $EPSILON for ST, in the same way like for BCs Consisten with BC: The user is getting a choice to specify the tolreance in ST or taking the default or using the one from GLI. --- FEM/rf_st_new.cpp | 25 +++++++++++++++++++++---- FEM/rf_st_new.h | 5 +++-- 2 files changed, 24 insertions(+), 6 deletions(-) diff --git a/FEM/rf_st_new.cpp b/FEM/rf_st_new.cpp index 6f255c73e..2e59d0387 100644 --- a/FEM/rf_st_new.cpp +++ b/FEM/rf_st_new.cpp @@ -118,6 +118,7 @@ CSourceTerm::CSourceTerm() // display_mode = false; //OK this->TimeInterpolation = 0; // BG _isConstrainedST = false; + epsilon = -1; } // KR: Conversion from GUI-ST-object to CSourceTerm @@ -321,6 +322,13 @@ std::ios::pos_type CSourceTerm::Read(std::ifstream* st_file, const GEOLIB::GEOOb continue; } + if (line_string.find("$EPSILON") != std::string::npos) + { + in.str(readNonBlankLineFromInputStream(*st_file)); + in >> epsilon; + in.clear(); + } + // 05.09.2008 WW if (line_string.find("$DIS_TYPE") != std::string::npos) { @@ -3284,10 +3292,10 @@ void CSourceTermGroup::SetSFC(CSourceTerm* m_st, const int ShiftInNodeVector) { GEOLIB::Surface const& sfc(*(dynamic_cast(m_st->getGeoObj()))); std::cout << "Surface " << m_st->geo_name << ": " << sfc.getNTriangles() << "\n"; - SetSurfaceNodeVector(&sfc, sfc_node_ids); + SetSurfaceNodeVector(&sfc, sfc_node_ids, m_st); /* - SetSurfaceNodeVector(m_sfc, sfc_nod_vector); + SetSurfaceNodeVector(m_sfc, sfc_nod_vector,m_st); */ sfc_nod_vector.insert(sfc_nod_vector.begin(), sfc_node_ids.begin(), sfc_node_ids.end()); if (m_st->isCoupled()) @@ -3371,16 +3379,25 @@ void CSourceTerm::SetNOD() 11/2007 JOD last modification: **************************************************************************/ -void CSourceTermGroup::SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector) +void CSourceTermGroup::SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector, CSourceTerm* st) { + double computed_search_length = m_msh->getSearchLength(); + if (st->epsilon != -1) + m_msh->setSearchLength(st->epsilon); const bool for_source = true; m_msh->GetNODOnSFC(m_sfc, sfc_nod_vector, for_source); + m_msh->setSearchLength(computed_search_length); } -void CSourceTermGroup::SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector) +void CSourceTermGroup::SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector, CSourceTerm* st) { + double computed_search_length = m_msh->getSearchLength(); + if (st->epsilon != -1) + m_msh->setSearchLength(st->epsilon); const bool for_source = true; m_msh->GetNODOnSFC(sfc, sfc_nod_vector, for_source); + m_msh->setSearchLength(computed_search_length); + } /************************************************************************** diff --git a/FEM/rf_st_new.h b/FEM/rf_st_new.h index 083dce7b9..f524d6ff3 100644 --- a/FEM/rf_st_new.h +++ b/FEM/rf_st_new.h @@ -232,6 +232,7 @@ class CSourceTerm : public ProcessInfo, public GeoInfo, public DistributionInfo void DeleteHistoryNodeMemory(); double geo_node_value; + double epsilon; /** * is the source term coupled with another source term @@ -385,8 +386,8 @@ class CSourceTermGroup std::vector& ply_nod_val_vector) const; // JOD - void SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector); - void SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector); + void SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector, CSourceTerm* st); + void SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector, CSourceTerm* st); void SetSurfaceNodeValueVector(CSourceTerm* m_st, Surface* m_sfc, std::vector const& sfc_nod_vector, From 4f30761004e2d6da4730293a29f928ef029c4e39 Mon Sep 17 00:00:00 2001 From: Thomas-TK Date: Mon, 3 Dec 2018 12:03:32 +0100 Subject: [PATCH 4/4] Revert "Allow $EPSILON for ST, in the same way like for BCs" This reverts commit 4dcd7a6f99ae032978449a20127bca2e65a52b9c. --- FEM/rf_st_new.cpp | 25 ++++--------------------- FEM/rf_st_new.h | 5 ++--- 2 files changed, 6 insertions(+), 24 deletions(-) diff --git a/FEM/rf_st_new.cpp b/FEM/rf_st_new.cpp index 2e59d0387..6f255c73e 100644 --- a/FEM/rf_st_new.cpp +++ b/FEM/rf_st_new.cpp @@ -118,7 +118,6 @@ CSourceTerm::CSourceTerm() // display_mode = false; //OK this->TimeInterpolation = 0; // BG _isConstrainedST = false; - epsilon = -1; } // KR: Conversion from GUI-ST-object to CSourceTerm @@ -322,13 +321,6 @@ std::ios::pos_type CSourceTerm::Read(std::ifstream* st_file, const GEOLIB::GEOOb continue; } - if (line_string.find("$EPSILON") != std::string::npos) - { - in.str(readNonBlankLineFromInputStream(*st_file)); - in >> epsilon; - in.clear(); - } - // 05.09.2008 WW if (line_string.find("$DIS_TYPE") != std::string::npos) { @@ -3292,10 +3284,10 @@ void CSourceTermGroup::SetSFC(CSourceTerm* m_st, const int ShiftInNodeVector) { GEOLIB::Surface const& sfc(*(dynamic_cast(m_st->getGeoObj()))); std::cout << "Surface " << m_st->geo_name << ": " << sfc.getNTriangles() << "\n"; - SetSurfaceNodeVector(&sfc, sfc_node_ids, m_st); + SetSurfaceNodeVector(&sfc, sfc_node_ids); /* - SetSurfaceNodeVector(m_sfc, sfc_nod_vector,m_st); + SetSurfaceNodeVector(m_sfc, sfc_nod_vector); */ sfc_nod_vector.insert(sfc_nod_vector.begin(), sfc_node_ids.begin(), sfc_node_ids.end()); if (m_st->isCoupled()) @@ -3379,25 +3371,16 @@ void CSourceTerm::SetNOD() 11/2007 JOD last modification: **************************************************************************/ -void CSourceTermGroup::SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector, CSourceTerm* st) +void CSourceTermGroup::SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector) { - double computed_search_length = m_msh->getSearchLength(); - if (st->epsilon != -1) - m_msh->setSearchLength(st->epsilon); const bool for_source = true; m_msh->GetNODOnSFC(m_sfc, sfc_nod_vector, for_source); - m_msh->setSearchLength(computed_search_length); } -void CSourceTermGroup::SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector, CSourceTerm* st) +void CSourceTermGroup::SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector) { - double computed_search_length = m_msh->getSearchLength(); - if (st->epsilon != -1) - m_msh->setSearchLength(st->epsilon); const bool for_source = true; m_msh->GetNODOnSFC(sfc, sfc_nod_vector, for_source); - m_msh->setSearchLength(computed_search_length); - } /************************************************************************** diff --git a/FEM/rf_st_new.h b/FEM/rf_st_new.h index f524d6ff3..083dce7b9 100644 --- a/FEM/rf_st_new.h +++ b/FEM/rf_st_new.h @@ -232,7 +232,6 @@ class CSourceTerm : public ProcessInfo, public GeoInfo, public DistributionInfo void DeleteHistoryNodeMemory(); double geo_node_value; - double epsilon; /** * is the source term coupled with another source term @@ -386,8 +385,8 @@ class CSourceTermGroup std::vector& ply_nod_val_vector) const; // JOD - void SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector, CSourceTerm* st); - void SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector, CSourceTerm* st); + void SetSurfaceNodeVector(Surface* m_sfc, std::vector& sfc_nod_vector); + void SetSurfaceNodeVector(GEOLIB::Surface const* sfc, std::vector& sfc_nod_vector); void SetSurfaceNodeValueVector(CSourceTerm* m_st, Surface* m_sfc, std::vector const& sfc_nod_vector,