From babe4fd600172ac7c99ab246ce2d997584ca7ef1 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 31 Jul 2023 22:36:56 +0300 Subject: [PATCH 01/21] Commenting out an unused class field. Not that its initialization assumes some restrictions on the template parameters of the class. This induced a compiler warning. --- ugbase/lib_algebra/active_set/active_set.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ugbase/lib_algebra/active_set/active_set.h b/ugbase/lib_algebra/active_set/active_set.h index 9f12113a2..58f8a6e6b 100644 --- a/ugbase/lib_algebra/active_set/active_set.h +++ b/ugbase/lib_algebra/active_set/active_set.h @@ -124,8 +124,8 @@ class ActiveSet /// constructor ActiveSet() : m_bObs(false), m_spLagMultDisc(NULL) { // specifies the number of fcts - value_type u_val; - m_nrFcts = GetSize(u_val); + //value_type u_val; + //m_nrFcts = GetSize(u_val); //ToDo: This field is only used in check_dist_to_obs which is commented out. Remove it completely? }; /// sets obstacle gridfunction, which limits the solution u @@ -187,7 +187,7 @@ class ActiveSet SmartPtr m_spDom; /// number of functions - size_t m_nrFcts; + //size_t m_nrFcts; //ToDo: This field is only used in check_dist_to_obs which is commented out. Remove it completely? /// pointer to a gridfunction describing an obstacle-constraint ConstSmartPtr m_spObs; From e87d1e56bd82ac49f26eb704a3985ee733f5513b Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 31 Jul 2023 23:04:01 +0300 Subject: [PATCH 02/21] Elimination of a compiler warning (about a variable used only when debug output is activated). --- .../ordering_strategies/algorithms/downwindorder.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ugbase/lib_disc/ordering_strategies/algorithms/downwindorder.cpp b/ugbase/lib_disc/ordering_strategies/algorithms/downwindorder.cpp index 718552a5b..47ab74af2 100644 --- a/ugbase/lib_disc/ordering_strategies/algorithms/downwindorder.cpp +++ b/ugbase/lib_disc/ordering_strategies/algorithms/downwindorder.cpp @@ -101,18 +101,16 @@ void OrderDownwindForDofDist(SmartPtr dd, ConstSmartPtr::iterator AdjIter; std::vector vAdjacency; - // count how many vertex were kept / removed per adjacency vector - size_t kept, removed = 0; - size_t initialcount = 0; - MathVector vVel1, vPos1, vPos2, vDir1_2; size_t i; for (VertexIter = vvConnections.begin(), i=0; VertexIter != vvConnections.end(); VertexIter++, i++) { UG_DLOG(LIB_DISC_ORDER, 2, "Filtering vertex " << i << " adjacency vector." <size(); - kept = 0; - removed = 0; + // count how many vertex were kept / removed per adjacency vector + #ifdef UG_ENABLE_DEBUG_LOGS + size_t initialcount = VertexIter->size(); + #endif + size_t kept = 0, removed = 0; // get position and velocity of first trait vPos1 = vPositions.at(i).first; (*spVelocity)(vVel1, vPos1, time, si); From 1bf11ddf01fd2ffeed62fad6c90e981b415bc97f Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Tue, 1 Aug 2023 10:14:19 +0300 Subject: [PATCH 03/21] Cosmetics. --- ugbase/lib_disc/function_spaces/interpolate.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/ugbase/lib_disc/function_spaces/interpolate.h b/ugbase/lib_disc/function_spaces/interpolate.h index c7d8a31a6..9399fcf57 100644 --- a/ugbase/lib_disc/function_spaces/interpolate.h +++ b/ugbase/lib_disc/function_spaces/interpolate.h @@ -584,17 +584,22 @@ template void Interpolate(SmartPtr > spInterpolFunction, SmartPtr spGridFct, const char* cmp, number time) -{Interpolate(spInterpolFunction, spGridFct, cmp, NULL, time);} +{ + Interpolate(spInterpolFunction, spGridFct, cmp, NULL, time); +} template void Interpolate(SmartPtr > spInterpolFunction, SmartPtr spGridFct, const char* cmp, const char* subsets) -{Interpolate(spInterpolFunction, spGridFct, cmp, subsets, 0.0);} +{ + Interpolate(spInterpolFunction, spGridFct, cmp, subsets, 0.0); +} template void Interpolate(SmartPtr > spInterpolFunction, SmartPtr spGridFct, const char* cmp) { - Interpolate(spInterpolFunction, spGridFct, cmp, NULL, 0.0);} + Interpolate(spInterpolFunction, spGridFct, cmp, NULL, 0.0); +} //interpolate with diff_vector template void Interpolate(SmartPtr > spInterpolFunction, From dccae314752eb30235aa6e5015d37ab003212564 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Tue, 1 Aug 2023 10:16:41 +0300 Subject: [PATCH 04/21] Cosmetics. --- .../bridge/disc_bridges/user_data_bridge.cpp | 24 +++++++++---------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/ugbase/bridge/disc_bridges/user_data_bridge.cpp b/ugbase/bridge/disc_bridges/user_data_bridge.cpp index 7a358b0b3..ae275c4e3 100644 --- a/ugbase/bridge/disc_bridges/user_data_bridge.cpp +++ b/ugbase/bridge/disc_bridges/user_data_bridge.cpp @@ -500,6 +500,17 @@ static void Dimension(Registry& reg, string grp) reg.add_class_to_group(name, "IntervalNumberLinker", dimTag); } +// GlobAttachmentElementUserData + { + typedef GlobAttachmentElementUserData T; + typedef CplUserData TBase; + string name = string("GlobAttachmentElementNumberData").append(dimSuffix); + reg.add_class_(name, grp) + .template add_constructor, const char *) >("AttachmentName") + .set_construct_as_smart_pointer(true); + reg.add_class_to_group(name, "GlobAttachmentElementNumberData", dimTag); + } + } /** @@ -519,19 +530,6 @@ static void Domain(Registry& reg, string grp) string suffix = GetDomainSuffix(); string tag = GetDomainTag(); - // GlobAttachmentElementUserData - { - string name = string("GlobAttachmentElementUserData").append(suffix); - typedef GlobAttachmentElementUserData T; - typedef CplUserData TBase; - reg.add_class_(name, grp) - .template add_constructor, const char *) >("AttachmentName") - .set_construct_as_smart_pointer(true); - reg.add_class_to_group(name, "GlobAttachmentElementUserData", tag); - - } - - // User data of a subset indicator (1 in the subset, 0 everywhere else) { string name = string("SubsetIndicatorUserData").append(suffix); From fa362529526fac3db4cabee57fe49f583a9c9c93 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Tue, 1 Aug 2023 10:18:13 +0300 Subject: [PATCH 05/21] Some rework. --- .../glob_attachment_user_data.h | 143 ++++++++++++------ 1 file changed, 99 insertions(+), 44 deletions(-) diff --git a/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h b/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h index db567de2c..19b0e9118 100644 --- a/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h +++ b/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h @@ -42,72 +42,127 @@ namespace ug{ -template +template class GlobAttachmentElementUserData -: public StdDependentUserData, number, TDomain::dim> +: public StdUserData, TData, WDim> + { - static const int dim = TDomain::dim; + static const int dim = WDim; + typedef TData data_type; + typedef typename grid_dim_traits::grid_base_object elem_type; + typedef Attachment attachment_type; private: std::string m_attachment_name; SmartPtr m_spGrid; - ANumber m_att; - typedef typename grid_dim_traits::grid_base_object TElem; + attachment_type m_att; + Grid::AttachmentAccessor m_aatt; + /// Evalutation of the attachment in one element + inline void eval_on_elem + ( + elem_type * elem, ///< the element to evaluate on + const size_t nip, ///< number of the values to write + data_type vValue [] ///< array for the values + ) const + { + for (size_t ip = 0; ip < nip; ++ip) + vValue[ip] = m_aatt [elem]; + } + public: - /// constructor + + /// constructor GlobAttachmentElementUserData(SmartPtr grid, const char* name) - : m_attachment_name(name), m_spGrid(grid) + : m_attachment_name(name), m_spGrid(grid) { - m_att = GlobalAttachments::attachment(m_attachment_name); + m_att = GlobalAttachments::attachment (m_attachment_name); + m_aatt.access (*grid, m_att); }; - - virtual bool continuous() const + + // UserData interface + + virtual bool continuous () const { return false; } + virtual bool requires_grid_fct () const + { + return true; + } + + // StdUserData interface template - void eval_and_deriv(number vValue[], - const MathVector vGlobIP[], - number time, int si, - GridObject* elem, - const MathVector vCornerCoords[], - const MathVector vLocIP[], - const size_t nip, - LocalVector* u, - bool bDeriv, - int s, - std::vector > vvvDeriv[], - const MathMatrix* vJT = NULL) const + inline void evaluate + ( + data_type vValue[], + const MathVector vGlobIP[], + number time, int si, + GridObject* elem, + const MathVector vCornerCoords[], + const MathVector vLocIP[], + const size_t nip, + LocalVector* u, + const MathMatrix* vJT = NULL + ) const { + UG_ASSERT (refDim == dim, "GlobAttachmentElementUserData: Dimensionality of the element should be equal to the world dimensionality."); + + eval_on_elem ((elem_type *) elem, nip, vValue); + } + + // StdUserData interface + + virtual void compute + ( + LocalVector* u, + GridObject* elem, + const MathVector vCornerCoords[], + bool bDeriv = false + ) + { + UG_ASSERT (elem->base_object_id() == dim, "GlobAttachmentElementUserData: Dimensionality of the element should be equal to the world dimensionality."); + + for (size_t s = 0; s < this->num_series (); ++s) + eval_on_elem ((elem_type *) elem, this->num_ip (s), this->values (s)); + } - if (refDim != dim) - { - UG_THROW ("GlobAttachmentElementUserData: Diamention of the element is not consistent."); - } + virtual void compute + ( + LocalVectorTimeSeries* u, + GridObject* elem, + const MathVector vCornerCoords[], + bool bDeriv = false + ) + { + UG_ASSERT (elem->base_object_id() == dim, "GlobAttachmentElementUserData: Dimensionality of the element should be equal to the world dimensionality."); - Grid::AttachmentAccessor aatt((Grid&)*m_spGrid, (ANumber &) m_att); - - // loop ips - for(size_t ip = 0; ip < nip; ++ip) - { - vValue[ip] = aatt[(TElem*)elem]; - - } - - if(bDeriv){ - UG_THROW ("GlobAttachmentElementUserData: Derivative not implemented."); - } + for (size_t s = 0; s < this->num_series (); ++s) + eval_on_elem ((elem_type *) elem, this->num_ip (s), this->values (s)); + } + virtual void operator () ///< cannot be implemented here + ( + data_type& value, + const MathVector& globIP, + number time, int si + ) const + { + UG_THROW("GlobAttachmentElementUserData: Element required" + " for evaluation, but not passed. Cannot evaluate."); } - - virtual void operator() (number& value, - const MathVector& globIP, - number time, int si, - Vertex* vrt) const + + virtual void operator () ///< cannot be implemented here + ( + data_type vValue[], + const MathVector vGlobIP[], + number time, int si, + const size_t nip + ) const { - UG_THROW ("GlobAttachmentElementUserData: Values at vertices of the grid function are not uniquely defined."); + UG_THROW("GlobAttachmentElementUserData: Element required" + " for evaluation, but not passed. Cannot evaluate."); } }; From 0922aa291ada07cf13703b20027e7f385bfd2c5a Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Tue, 1 Aug 2023 10:19:05 +0300 Subject: [PATCH 06/21] Corrections in the texts of error messages. --- .../function_spaces/grid_function_user_data_explicit.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ugbase/lib_disc/function_spaces/grid_function_user_data_explicit.h b/ugbase/lib_disc/function_spaces/grid_function_user_data_explicit.h index d49cc8135..73e188f17 100644 --- a/ugbase/lib_disc/function_spaces/grid_function_user_data_explicit.h +++ b/ugbase/lib_disc/function_spaces/grid_function_user_data_explicit.h @@ -143,7 +143,7 @@ class StdExplicitGridFunctionData case 1: eval<1>(u,elem,vCornerCoords,bDeriv); break; case 2: eval<2>(u,elem,vCornerCoords,bDeriv); break; case 3: eval<3>(u,elem,vCornerCoords,bDeriv); break; - default: UG_THROW("StdDependentUserData: Dimension not supported."); + default: UG_THROW("StdExplicitGridFunctionData: Dimension not supported."); } } @@ -158,7 +158,7 @@ class StdExplicitGridFunctionData case 1: eval<1>(u,elem,vCornerCoords,bDeriv); break; case 2: eval<2>(u,elem,vCornerCoords,bDeriv); break; case 3: eval<3>(u,elem,vCornerCoords,bDeriv); break; - default: UG_THROW("StdDependentUserData: Dimension not supported."); + default: UG_THROW("StdExplicitGridFunctionData: Dimension not supported."); } } @@ -493,7 +493,7 @@ class ExplicitGridFunctionGradient // store tmp Gradient vJT = &(vJTTmp[0]); - }UG_CATCH_THROW("GridFunctionGradientData: failed."); + }UG_CATCH_THROW("ExplicitGridFunctionGradient: failed."); } // scale with coeficient From d76a20d0f4af6b129332562c21a5a1e6d8d0ec74 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Tue, 1 Aug 2023 13:11:12 +0300 Subject: [PATCH 07/21] Fixing the CMake version messages (that 3.5 and below will be unsupported in the future). 1. In some subordinated files, the version checking command is removed. 2. In the other CMakeLists.txt, the upper tested version is specified to 3.27.1. --- CMakeLists.txt | 2 +- ugbase/CMakeLists.txt | 2 +- ugbase/bindings/lua/CMakeLists.txt | 2 +- ugbase/bridge/CMakeLists.txt | 2 -- ugbase/common/CMakeLists.txt | 2 +- ugbase/common/node_tree/CMakeLists.txt | 2 -- ugbase/compile_info/CMakeLists.txt | 2 -- ugbase/lib_algebra/CMakeLists.txt | 2 +- ugbase/lib_disc/CMakeLists.txt | 2 +- ugbase/lib_grid/CMakeLists.txt | 2 +- ugbase/pcl/CMakeLists.txt | 2 +- ugbase/registry/CMakeLists.txt | 2 -- ugbase/ug_shell/CMakeLists.txt | 2 +- 13 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 043305a7e..cd2acc0f3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) ################################################ # ug4 diff --git a/ugbase/CMakeLists.txt b/ugbase/CMakeLists.txt index 1dc341d72..670f92c62 100644 --- a/ugbase/CMakeLists.txt +++ b/ugbase/CMakeLists.txt @@ -32,7 +32,7 @@ # ugbase ################################################ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) project(P_UGBASE) diff --git a/ugbase/bindings/lua/CMakeLists.txt b/ugbase/bindings/lua/CMakeLists.txt index 600c2337c..db29e25ae 100644 --- a/ugbase/bindings/lua/CMakeLists.txt +++ b/ugbase/bindings/lua/CMakeLists.txt @@ -28,7 +28,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) #### # uginterface Library diff --git a/ugbase/bridge/CMakeLists.txt b/ugbase/bridge/CMakeLists.txt index bb817ffd9..752f61c85 100644 --- a/ugbase/bridge/CMakeLists.txt +++ b/ugbase/bridge/CMakeLists.txt @@ -28,8 +28,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) - #### # ug_bridge Library #### diff --git a/ugbase/common/CMakeLists.txt b/ugbase/common/CMakeLists.txt index e09c0bd77..9713dcde9 100644 --- a/ugbase/common/CMakeLists.txt +++ b/ugbase/common/CMakeLists.txt @@ -28,7 +28,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) ################################################ # common diff --git a/ugbase/common/node_tree/CMakeLists.txt b/ugbase/common/node_tree/CMakeLists.txt index 1a1debf46..43ab0dc83 100644 --- a/ugbase/common/node_tree/CMakeLists.txt +++ b/ugbase/common/node_tree/CMakeLists.txt @@ -28,8 +28,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) - ################################################ # node-tree ################################################ diff --git a/ugbase/compile_info/CMakeLists.txt b/ugbase/compile_info/CMakeLists.txt index f77fa00bf..2f05aca34 100644 --- a/ugbase/compile_info/CMakeLists.txt +++ b/ugbase/compile_info/CMakeLists.txt @@ -28,8 +28,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) - ################################################ # ug4 - compile-info ################################################ diff --git a/ugbase/lib_algebra/CMakeLists.txt b/ugbase/lib_algebra/CMakeLists.txt index 8bab5ae58..8dec94058 100644 --- a/ugbase/lib_algebra/CMakeLists.txt +++ b/ugbase/lib_algebra/CMakeLists.txt @@ -28,7 +28,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required (VERSION 2.8.12) +cmake_minimum_required (VERSION 2.8.12...3.27.1) project (P_LIB_ALGEBRA) diff --git a/ugbase/lib_disc/CMakeLists.txt b/ugbase/lib_disc/CMakeLists.txt index de8fce379..656bacecd 100644 --- a/ugbase/lib_disc/CMakeLists.txt +++ b/ugbase/lib_disc/CMakeLists.txt @@ -28,7 +28,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) project(P_LIB_DISCRETIZATION) diff --git a/ugbase/lib_grid/CMakeLists.txt b/ugbase/lib_grid/CMakeLists.txt index 78eee3f3e..a846e329d 100644 --- a/ugbase/lib_grid/CMakeLists.txt +++ b/ugbase/lib_grid/CMakeLists.txt @@ -32,7 +32,7 @@ # lib_grid ################################################ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) project(P_LIB_GRID) diff --git a/ugbase/pcl/CMakeLists.txt b/ugbase/pcl/CMakeLists.txt index e88813849..b55083e41 100644 --- a/ugbase/pcl/CMakeLists.txt +++ b/ugbase/pcl/CMakeLists.txt @@ -32,7 +32,7 @@ # Parallel Communication Layer ################################################ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) project(P_PCL) diff --git a/ugbase/registry/CMakeLists.txt b/ugbase/registry/CMakeLists.txt index 87869fbde..b235123fd 100644 --- a/ugbase/registry/CMakeLists.txt +++ b/ugbase/registry/CMakeLists.txt @@ -28,8 +28,6 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU Lesser General Public License for more details. -cmake_minimum_required(VERSION 2.8.12) - #### # registry Library #### diff --git a/ugbase/ug_shell/CMakeLists.txt b/ugbase/ug_shell/CMakeLists.txt index f7ec7d19e..abb4857f5 100644 --- a/ugbase/ug_shell/CMakeLists.txt +++ b/ugbase/ug_shell/CMakeLists.txt @@ -58,7 +58,7 @@ ################################################################################ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 2.8.12...3.27.1) #### # ugscript Library From ccc85f3a1420086c19bbc7d8cc9e7511d3deb791 Mon Sep 17 00:00:00 2001 From: Dmitry Logashenko Date: Tue, 1 Aug 2023 22:21:54 +0300 Subject: [PATCH 08/21] Fixing the type cast that lead to multiple compiler warnings. --- .../lib_algebra/small_algebra/storage/variable_array_impl.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ugbase/lib_algebra/small_algebra/storage/variable_array_impl.h b/ugbase/lib_algebra/small_algebra/storage/variable_array_impl.h index 3d62ff503..6f018f341 100644 --- a/ugbase/lib_algebra/small_algebra/storage/variable_array_impl.h +++ b/ugbase/lib_algebra/small_algebra/storage/variable_array_impl.h @@ -103,7 +103,7 @@ VariableArray1::resize(size_t newN, bool bCopyValues) value_type *new_values = new T[newN]; UG_ASSERT(new_values != NULL, "out of memory"); if(new_values == NULL) return false; - memset(new_values, 0, sizeof(T)*newN); // todo: think about that + memset(reinterpret_cast (new_values), 0, sizeof(T)*newN); // todo: think about that if(bCopyValues) { @@ -247,7 +247,7 @@ VariableArray2::resize(size_t newRows, size_t newCols, bool bCopy } value_type *new_values = new T[newRows*newCols]; - memset(new_values, 0, sizeof(T)*newRows*newCols); // todo: think about that + memset(reinterpret_cast (new_values), 0, sizeof(T)*newRows*newCols); // todo: think about that UG_ASSERT(new_values != NULL, "out of memory"); if(new_values==NULL) return false; /* From 2a1cfda3fefc17963adea1cb0a29c40265af3a65 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 14 Aug 2023 14:39:32 +0300 Subject: [PATCH 09/21] Cosmetics in a comment. --- ugbase/common/math/misc/math_util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ugbase/common/math/misc/math_util.h b/ugbase/common/math/misc/math_util.h index 87360330b..6181190b8 100644 --- a/ugbase/common/math/misc/math_util.h +++ b/ugbase/common/math/misc/math_util.h @@ -704,7 +704,7 @@ int BinomCoeff(int n, int k); * This method reflects a given vector at a plane specified by n and r0, i.e. * the plane P is given such that for all \f$ \vec{x} in P \f$ it holds that * \f[ - * (\vec{x}�- \vec{r0}) \cdot \vec{n} = 0. + * (\vec{x} - \vec{r0}) \cdot \vec{n} = 0. * \f] * * @param vReflectedOut the reflected vector From e805547292b5699630d6332daa07a9629e700f6a Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 14 Aug 2023 14:42:37 +0300 Subject: [PATCH 10/21] Checking if the global attachment is declared. Note however that global attachments are currently not really parallelized: If loaded from a geometry file, they are loaded only into the master process. --- .../user_data/common_user_data/glob_attachment_user_data.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h b/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h index 19b0e9118..3b19a3014 100644 --- a/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h +++ b/ugbase/lib_disc/spatial_disc/user_data/common_user_data/glob_attachment_user_data.h @@ -76,7 +76,9 @@ class GlobAttachmentElementUserData GlobAttachmentElementUserData(SmartPtr grid, const char* name) : m_attachment_name(name), m_spGrid(grid) { - m_att = GlobalAttachments::attachment (m_attachment_name); + if (! GlobalAttachments::is_declared (m_attachment_name)) + UG_THROW ("GlobAttachmentElementUserData: No global attachment '" << m_attachment_name << "' found."); + m_att = GlobalAttachments::attachment (m_attachment_name); m_aatt.access (*grid, m_att); }; From 5960fdae3c81e639f0488597b699bf2c337b44e2 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 14 Aug 2023 15:31:15 +0300 Subject: [PATCH 11/21] Making a formula to be correctly LaTeXed in the documentation. --- docs/lib_disc/additional_pages/ip_data/import_export.doxygen | 1 - 1 file changed, 1 deletion(-) diff --git a/docs/lib_disc/additional_pages/ip_data/import_export.doxygen b/docs/lib_disc/additional_pages/ip_data/import_export.doxygen index 55391940e..122311a25 100644 --- a/docs/lib_disc/additional_pages/ip_data/import_export.doxygen +++ b/docs/lib_disc/additional_pages/ip_data/import_export.doxygen @@ -127,7 +127,6 @@ Thus, the Import can be described by \mathcal{I}: \mathbb{R}^d \times \mathbb{R} \times \mathbb{R}^{N_1} \times \dots \times \mathbb{R}^{N_{n_{sys}}} &\mapsto \mathcal{D} \\ - \vec{x}, t, \vec{u}^1, \dots, \vec{u}^{n_{sys}} &\mapsto \mathcal{I}(\vec{x}, t, \vec{u}^1, \dots, \vec{u}^{n_{sys}}) \f} From 6f1a6aa9edfbe46096a8816d93afa5345a7e25f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 14 Aug 2023 16:03:04 +0300 Subject: [PATCH 12/21] Cosmetics in the Doxygen docu: DOIs in the references, LaTeX syntax corrections. --- .../spatial_disc/disc_util/conv_shape_interface.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h b/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h index cd4a701cb..4c5f0a92b 100644 --- a/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h +++ b/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h @@ -52,9 +52,9 @@ namespace ug{ *
  • P. Frolkovic, H. De Schepper, Numerical Modelling of Convection Dominated * Transport Coupled with Density Driven Flow in Porous Media. * Advances in Water Resources 24 (1): 63–72, 2000, DOI: 10.1016/S0309-1708(00)00025-7
  • - *
  • K. W. Morton, D. F. Mayers, Numerical Solution of Partial Differential - * Equations, Cambridge University Press, 1994
  • - *
  • R. J. Le Veque, Numerical Methods for Conservation Laws, Birkhäuser, 1990
  • + *
  • K. W. Morton, D. Mayers, Numerical Solution of Partial Differential Equations: + * An Introduction (2nd ed.), Cambridge: Cambridge University Press, 2005, DOI: 10.1017/CBO9780511812248
  • + *
  • R. J. LeVeque, Numerical Methods for Conservation Laws (2nd ed.), Springer Basel AG, 1992, DOI: 10.1007/978-3-0348-8629-1
  • * * Convection shapes is one of possible implementations of upwind methods, * in which the upwind is considered as a special kind of interpolation of degrees @@ -78,7 +78,7 @@ namespace ug{ * through a subcontrol volume face with the integration point \f$ip\f$ is * \f[ \sum_{s=1}^{n_s} \phi_s (ip) \, c_s, \f] * where \f$\phi_s (ip)\f$ are the values of the \f$n_s\f$ ``convection shapes'' - * at \f$ip\f$, whereas $c_s$ are the degrees of freedom of \f$c\f$ corresponding + * at \f$ip\f$, whereas \f$c_s\f$ are the degrees of freedom of \f$c\f$ corresponding * to the shapes. * * Although the convection shapes for every upwind method are based on the From 86a92e3435733d7cc4963f3249a96abd75532644 Mon Sep 17 00:00:00 2001 From: Shuai Lu Date: Thu, 17 Aug 2023 16:52:55 +0300 Subject: [PATCH 13/21] declare attachments on all processors after loading grids --- ugbase/lib_disc/domain_util.cpp | 43 ++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/ugbase/lib_disc/domain_util.cpp b/ugbase/lib_disc/domain_util.cpp index 4e4f974c6..b6b17e63b 100644 --- a/ugbase/lib_disc/domain_util.cpp +++ b/ugbase/lib_disc/domain_util.cpp @@ -79,7 +79,48 @@ void LoadDomain(TDomain& domain, const char* filename, int procId) { UG_THROW("LoadDomain: Could not load file: "< possible_attachment_names = {"PORO", "PERM", "PERMX", "PERMY", "PERMZ"}; + vector locDeclared(possible_attachment_names.size(), 0); + vector globDeclared(possible_attachment_names.size(), 0); + // record local info + for(size_t i = 0; i < possible_attachment_names.size(); ++i){ + byte& b = locDeclared[i]; + if(GlobalAttachments::is_declared(possible_attachment_names[i])){ + b |= 1; + if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) + b |= 1<<1; + if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) + b |= 1<<2; + if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) + b |= 1<<3; + if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) + b |= 1<<4; + } + } + // sum up all the local to the global + procComm.allreduce(locDeclared, globDeclared, PCL_RO_BOR); + // update the local with the global + for(size_t i = 0; i < possible_attachment_names.size(); ++i){ + byte& b = globDeclared[i]; + if(b & 1){ + if(!GlobalAttachments::is_declared(possible_attachment_names[i])) + GlobalAttachments::declare_attachment(possible_attachment_names[i], "double", true); + if(b & 1<<1) + GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); + if(b & 1<<2) + GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); + if(b & 1<<3) + GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); + if(b & 1<<4) + GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); + } + } + #endif + if(num_ph > 0) { domain.set_refinement_projector(ph); From a58b47ea81913463cf779342e442a7ee5efdb7fa Mon Sep 17 00:00:00 2001 From: Arne Naegel Date: Wed, 23 Aug 2023 21:17:40 +0200 Subject: [PATCH 14/21] Update json_util.lua --- scripts/util/json_util.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/util/json_util.lua b/scripts/util/json_util.lua index cacdcc59c..747397f63 100644 --- a/scripts/util/json_util.lua +++ b/scripts/util/json_util.lua @@ -3,8 +3,8 @@ util = util or {} -- If UG_JSON is active, load third party module as util.json if IsDefinedUG_JSON() then - local jsonPath = ug_get_root_path().."externals/JSONForUG4/json-lua/" + local jsonPath = ug_get_root_path().."/externals/JSONForUG4/json-lua/" package.path = package.path..";".. jsonPath.."?.lua" util.json = require("json") -end \ No newline at end of file +end From 2b14e06aca3ed111d7187a4fcf6e894614175f41 Mon Sep 17 00:00:00 2001 From: Shuai Lu Date: Thu, 24 Aug 2023 19:46:14 +0300 Subject: [PATCH 15/21] Move SynchronizeDeclaredGlobalAttachments to global_attachments.h --- ugbase/lib_disc/domain_util.cpp | 41 -------------------------- ugbase/lib_grid/file_io/file_io.cpp | 19 ++++++++++-- ugbase/lib_grid/global_attachments.h | 43 ++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 43 deletions(-) diff --git a/ugbase/lib_disc/domain_util.cpp b/ugbase/lib_disc/domain_util.cpp index b6b17e63b..d180420a8 100644 --- a/ugbase/lib_disc/domain_util.cpp +++ b/ugbase/lib_disc/domain_util.cpp @@ -80,47 +80,6 @@ void LoadDomain(TDomain& domain, const char* filename, int procId) UG_THROW("LoadDomain: Could not load file: "< possible_attachment_names = {"PORO", "PERM", "PERMX", "PERMY", "PERMZ"}; - vector locDeclared(possible_attachment_names.size(), 0); - vector globDeclared(possible_attachment_names.size(), 0); - // record local info - for(size_t i = 0; i < possible_attachment_names.size(); ++i){ - byte& b = locDeclared[i]; - if(GlobalAttachments::is_declared(possible_attachment_names[i])){ - b |= 1; - if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) - b |= 1<<1; - if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) - b |= 1<<2; - if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) - b |= 1<<3; - if(GlobalAttachments::is_attached(*domain.grid(), possible_attachment_names[i])) - b |= 1<<4; - } - } - // sum up all the local to the global - procComm.allreduce(locDeclared, globDeclared, PCL_RO_BOR); - // update the local with the global - for(size_t i = 0; i < possible_attachment_names.size(); ++i){ - byte& b = globDeclared[i]; - if(b & 1){ - if(!GlobalAttachments::is_declared(possible_attachment_names[i])) - GlobalAttachments::declare_attachment(possible_attachment_names[i], "double", true); - if(b & 1<<1) - GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); - if(b & 1<<2) - GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); - if(b & 1<<3) - GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); - if(b & 1<<4) - GlobalAttachments::attach(*domain.grid(), possible_attachment_names[i]); - } - } - #endif - if(num_ph > 0) { domain.set_refinement_projector(ph); diff --git a/ugbase/lib_grid/file_io/file_io.cpp b/ugbase/lib_grid/file_io/file_io.cpp index 46880a354..8c67a91f8 100644 --- a/ugbase/lib_grid/file_io/file_io.cpp +++ b/ugbase/lib_grid/file_io/file_io.cpp @@ -223,9 +223,24 @@ static bool LoadGrid(Grid& grid, ISubsetHandler* psh, } } } + + // declare global attachments on all processors + #ifdef UG_PARALLEL + pcl::ProcessCommunicator procComm; + vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); + // only master proc loaded the grid + if (procId == 0) + procComm.broadcast >(possible_attachment_names, procId); + else + UG_THROW("There are more than one proc loading the grid"<< + "please make sure all processes broadcast their GlobalAttachments"); + GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, possible_attachment_names); + #endif + grid.message_hub()->post_message(GridMessage_Creation(GMCT_CREATION_STOPS, procId)); - + + #ifdef UG_PARALLEL pcl::ProcessCommunicator procCom; if(procId == -1) @@ -938,7 +953,7 @@ bool SaveGridLevelToFile(MultiGrid& srcMG, ISubsetHandler& srcSH, int lvl, const return SaveGridLevel(srcMG, srcSH, lvl, filename, aPosition1); return false; -} +} //////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////// diff --git a/ugbase/lib_grid/global_attachments.h b/ugbase/lib_grid/global_attachments.h index 81819233a..0783efa34 100644 --- a/ugbase/lib_grid/global_attachments.h +++ b/ugbase/lib_grid/global_attachments.h @@ -125,6 +125,49 @@ class GlobalAttachments { { return attachment_types().find(typeName) != attachment_types().end(); } + + static void SynchronizeDeclaredGlobalAttachments(Grid& grid, const std::vector possible_attachment_names) + { + //declare global attachments on all processors + pcl::ProcessCommunicator procComm; + + std::vector locDeclared(possible_attachment_names.size(), 0); + std::vector globDeclared(possible_attachment_names.size(), 0); + // record local info + for(size_t i = 0; i < possible_attachment_names.size(); ++i){ + byte& b = locDeclared[i]; + if(GlobalAttachments::is_declared(possible_attachment_names[i])){ + b |= 1; + if(GlobalAttachments::is_attached(grid, possible_attachment_names[i])) + b |= 1<<1; + if(GlobalAttachments::is_attached(grid, possible_attachment_names[i])) + b |= 1<<2; + if(GlobalAttachments::is_attached(grid, possible_attachment_names[i])) + b |= 1<<3; + if(GlobalAttachments::is_attached(grid, possible_attachment_names[i])) + b |= 1<<4; + } + } + // sum up all the local to the global + procComm.allreduce(locDeclared, globDeclared, PCL_RO_BOR); + // update the local with the global + for(size_t i = 0; i < possible_attachment_names.size(); ++i){ + byte& b = globDeclared[i]; + if(b & 1){ + if(!GlobalAttachments::is_declared(possible_attachment_names[i])) + GlobalAttachments::declare_attachment(possible_attachment_names[i], "double", true); + if(b & 1<<1) + GlobalAttachments::attach(grid, possible_attachment_names[i]); + if(b & 1<<2) + GlobalAttachments::attach(grid, possible_attachment_names[i]); + if(b & 1<<3) + GlobalAttachments::attach(grid, possible_attachment_names[i]); + if(b & 1<<4) + GlobalAttachments::attach(grid, possible_attachment_names[i]); + } + } + + } template static From 371537d77576978e6a48da35c9dc26d05fbe1db8 Mon Sep 17 00:00:00 2001 From: Shuai Lu Date: Thu, 24 Aug 2023 19:52:41 +0300 Subject: [PATCH 16/21] Include another load function --- ugbase/lib_grid/file_io/file_io.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/ugbase/lib_grid/file_io/file_io.cpp b/ugbase/lib_grid/file_io/file_io.cpp index 8c67a91f8..90402fbdd 100644 --- a/ugbase/lib_grid/file_io/file_io.cpp +++ b/ugbase/lib_grid/file_io/file_io.cpp @@ -300,6 +300,20 @@ static bool LoadGrid(Grid& grid, SPProjectionHandler* ph, size_t& num_ph, ISubse } } + + // declare global attachments on all processors + #ifdef UG_PARALLEL + pcl::ProcessCommunicator procComm; + vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); + // only master proc loaded the grid + if (procId == 0) + procComm.broadcast >(possible_attachment_names, procId); + else + UG_THROW("There are more than one proc loading the grid"<< + "please make sure all processes broadcast their GlobalAttachments"); + + GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, possible_attachment_names); + #endif grid.message_hub()->post_message(GridMessage_Creation(GMCT_CREATION_STOPS, procId)); From 75424c4d6073e3b027276404b280a66957dac62a Mon Sep 17 00:00:00 2001 From: Shuai Lu Date: Sun, 27 Aug 2023 17:31:44 +0300 Subject: [PATCH 17/21] Move SynchronizeDeclaredGlobalAttachments to global_attachments.h --- ugbase/lib_grid/file_io/file_io.cpp | 22 ++-------------------- ugbase/lib_grid/global_attachments.h | 15 ++++++++++++--- 2 files changed, 14 insertions(+), 23 deletions(-) diff --git a/ugbase/lib_grid/file_io/file_io.cpp b/ugbase/lib_grid/file_io/file_io.cpp index 90402fbdd..18d7c2ff0 100644 --- a/ugbase/lib_grid/file_io/file_io.cpp +++ b/ugbase/lib_grid/file_io/file_io.cpp @@ -226,16 +226,7 @@ static bool LoadGrid(Grid& grid, ISubsetHandler* psh, // declare global attachments on all processors #ifdef UG_PARALLEL - pcl::ProcessCommunicator procComm; - vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); - // only master proc loaded the grid - if (procId == 0) - procComm.broadcast >(possible_attachment_names, procId); - else - UG_THROW("There are more than one proc loading the grid"<< - "please make sure all processes broadcast their GlobalAttachments"); - - GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, possible_attachment_names); + GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, procId); #endif grid.message_hub()->post_message(GridMessage_Creation(GMCT_CREATION_STOPS, procId)); @@ -303,16 +294,7 @@ static bool LoadGrid(Grid& grid, SPProjectionHandler* ph, size_t& num_ph, ISubse // declare global attachments on all processors #ifdef UG_PARALLEL - pcl::ProcessCommunicator procComm; - vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); - // only master proc loaded the grid - if (procId == 0) - procComm.broadcast >(possible_attachment_names, procId); - else - UG_THROW("There are more than one proc loading the grid"<< - "please make sure all processes broadcast their GlobalAttachments"); - - GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, possible_attachment_names); + GlobalAttachments::SynchronizeDeclaredGlobalAttachments(grid, procId); #endif grid.message_hub()->post_message(GridMessage_Creation(GMCT_CREATION_STOPS, procId)); diff --git a/ugbase/lib_grid/global_attachments.h b/ugbase/lib_grid/global_attachments.h index 0783efa34..d41d89930 100644 --- a/ugbase/lib_grid/global_attachments.h +++ b/ugbase/lib_grid/global_attachments.h @@ -126,11 +126,19 @@ class GlobalAttachments { return attachment_types().find(typeName) != attachment_types().end(); } - static void SynchronizeDeclaredGlobalAttachments(Grid& grid, const std::vector possible_attachment_names) + #ifdef UG_PARALLEL + static void SynchronizeDeclaredGlobalAttachments(Grid& grid, int procId) { //declare global attachments on all processors pcl::ProcessCommunicator procComm; - + std::vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); + // only master proc loaded the grid + if (procId == 0) + procComm.broadcast >(possible_attachment_names, procId); + else + UG_THROW("There are more than one proc loading the grid"<< + "please make sure all processes broadcast their GlobalAttachments"); + std::vector locDeclared(possible_attachment_names.size(), 0); std::vector globDeclared(possible_attachment_names.size(), 0); // record local info @@ -168,7 +176,8 @@ class GlobalAttachments { } } - + #endif + template static void attach(Grid& g, const std::string& name) From 0f65fa8c1278649ad98d6bc6dda34b3d8ecf273c Mon Sep 17 00:00:00 2001 From: Shuai Lu Date: Sun, 27 Aug 2023 17:34:25 +0300 Subject: [PATCH 18/21] correct typo --- ugbase/lib_grid/file_io/file_io_grdecl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ugbase/lib_grid/file_io/file_io_grdecl.cpp b/ugbase/lib_grid/file_io/file_io_grdecl.cpp index 950ca97f4..c87cc0d14 100644 --- a/ugbase/lib_grid/file_io/file_io_grdecl.cpp +++ b/ugbase/lib_grid/file_io/file_io_grdecl.cpp @@ -517,7 +517,7 @@ bool LoadGridFromGRDECL(Grid& grid, const char* filename, AVector3& aPos) else GetCoord(buf, coord); } - if (buf.compare(0,6,"COORD ")==0 or buf.compare(0,7,"COORD\r")==0) + if (buf.compare(0,6,"COORD ")==0 || buf.compare(0,7,"COORD\r")==0) b=true; //Get the depth list From 911ad5efc64d77f7551c7a4086203990230cc638 Mon Sep 17 00:00:00 2001 From: Dmitriy Logashenko Date: Mon, 28 Aug 2023 17:28:36 +0300 Subject: [PATCH 19/21] Cosmetics: Renaming "upwind shape" to "convection shape" in the names of private variables. --- .../disc_util/conv_shape_interface.h | 60 +++++++++---------- 1 file changed, 30 insertions(+), 30 deletions(-) diff --git a/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h b/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h index 4c5f0a92b..cde231f0d 100644 --- a/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h +++ b/ugbase/lib_disc/spatial_disc/disc_util/conv_shape_interface.h @@ -115,9 +115,9 @@ class IConvectionShapes : m_numScvf(0), m_numSh(0), m_bNonZeroDerivDiffusion(true) { m_vUpdateFunc.clear(); - m_vUpShape.clear(); - m_vUpShapeVel.clear(); - m_vUpShapeDiffusion.clear(); + m_vConvShape.clear(); + m_vConvShapeVel.clear(); + m_vConvShapeDiffusion.clear(); } /// destructor @@ -132,17 +132,17 @@ class IConvectionShapes /// shape value number operator()(size_t scvf, size_t sh) const { - UG_ASSERT(scvf < m_vUpShape.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShape[scvf].size(), "Invalid index"); - return m_vUpShape[scvf][sh]; + UG_ASSERT(scvf < m_vConvShape.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShape[scvf].size(), "Invalid index"); + return m_vConvShape[scvf][sh]; } /// upwind shape for corner vel const MathVector& D_vel(size_t scvf, size_t sh) const { - UG_ASSERT(scvf < m_vUpShapeVel.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShapeVel[scvf].size(), "Invalid index"); - return m_vUpShapeVel[scvf][sh]; + UG_ASSERT(scvf < m_vConvShapeVel.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShapeVel[scvf].size(), "Invalid index"); + return m_vConvShapeVel[scvf][sh]; } /// returns if upwind shape w.r.t. ip vel is non-zero @@ -151,9 +151,9 @@ class IConvectionShapes /// upwind shapes for ip vel const MathMatrix& D_diffusion(size_t scvf, size_t sh) const { - UG_ASSERT(scvf < m_vUpShapeDiffusion.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShapeDiffusion[scvf].size(), "Invalid index"); - return m_vUpShapeDiffusion[scvf][sh]; + UG_ASSERT(scvf < m_vConvShapeDiffusion.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShapeDiffusion[scvf].size(), "Invalid index"); + return m_vConvShapeDiffusion[scvf][sh]; } bool update(const FVGeometryBase* geo, @@ -176,25 +176,25 @@ class IConvectionShapes /// non-const access to ip velocity (i.e. interpolated velocity at ip) number& conv_shape(size_t scvf, size_t sh) { - UG_ASSERT(scvf < m_vUpShape.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShape[scvf].size(), "Invalid index"); - return m_vUpShape[scvf][sh]; + UG_ASSERT(scvf < m_vConvShape.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShape[scvf].size(), "Invalid index"); + return m_vConvShape[scvf][sh]; } /// non-const access to upwind shapes for corner vel MathVector& D_vel(size_t scvf, size_t sh) { - UG_ASSERT(scvf < m_vUpShapeVel.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShapeVel[scvf].size(), "Invalid index"); - return m_vUpShapeVel[scvf][sh]; + UG_ASSERT(scvf < m_vConvShapeVel.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShapeVel[scvf].size(), "Invalid index"); + return m_vConvShapeVel[scvf][sh]; } /// non-const access to upwind shapes for ip vel MathMatrix& conv_shape_diffusion(size_t scvf, size_t sh) { - UG_ASSERT(scvf < m_vUpShapeDiffusion.size(), "Invalid index"); - UG_ASSERT(sh < m_vUpShapeDiffusion[scvf].size(), "Invalid index"); - return m_vUpShapeDiffusion[scvf][sh]; + UG_ASSERT(scvf < m_vConvShapeDiffusion.size(), "Invalid index"); + UG_ASSERT(sh < m_vConvShapeDiffusion[scvf].size(), "Invalid index"); + return m_vConvShapeDiffusion[scvf][sh]; } @@ -205,13 +205,13 @@ class IConvectionShapes size_t m_numSh; /// upwind shapes for corners shape functions - std::vector > m_vUpShape; + std::vector > m_vConvShape; /// upwind shapes for corners shape functions - std::vector > > m_vUpShapeVel; + std::vector > > m_vConvShapeVel; /// upwind shapes for corners shape functions - std::vector > > m_vUpShapeDiffusion; + std::vector > > m_vConvShapeDiffusion; /// flag if ip shapes are non-zero bool m_bNonZeroDerivDiffusion; @@ -299,14 +299,14 @@ set_sizes(size_t numScvf, size_t numSh) m_numSh = numSh; // adjust arrays - m_vUpShape.resize(m_numScvf); - m_vUpShapeVel.resize(m_numScvf); - m_vUpShapeDiffusion.resize(m_numScvf); + m_vConvShape.resize(m_numScvf); + m_vConvShapeVel.resize(m_numScvf); + m_vConvShapeDiffusion.resize(m_numScvf); for(size_t scvf = 0; scvf < m_numScvf; ++scvf) { - m_vUpShape[scvf].resize(m_numSh); - m_vUpShapeVel[scvf].resize(m_numSh); - m_vUpShapeDiffusion[scvf].resize(m_numSh); + m_vConvShape[scvf].resize(m_numSh); + m_vConvShapeVel[scvf].resize(m_numSh); + m_vConvShapeDiffusion[scvf].resize(m_numSh); } } From 303a7cd3e3599534cfd201a434fbe81057777611 Mon Sep 17 00:00:00 2001 From: Dmitry Logashenko Date: Thu, 5 Oct 2023 17:19:59 +0300 Subject: [PATCH 20/21] Fixing parallelization of loading of global attachments in special cases. --- ugbase/lib_grid/global_attachments.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ugbase/lib_grid/global_attachments.h b/ugbase/lib_grid/global_attachments.h index d41d89930..19cc09e91 100644 --- a/ugbase/lib_grid/global_attachments.h +++ b/ugbase/lib_grid/global_attachments.h @@ -129,6 +129,8 @@ class GlobalAttachments { #ifdef UG_PARALLEL static void SynchronizeDeclaredGlobalAttachments(Grid& grid, int procId) { + if (procId < 0) return; // this is not a parallel run + //declare global attachments on all processors pcl::ProcessCommunicator procComm; std::vector possible_attachment_names = GlobalAttachments::declared_attachment_names(); From 4123266cba2e034698a3bc318e482587a1ed2009 Mon Sep 17 00:00:00 2001 From: Arne Naegel Date: Tue, 17 Oct 2023 16:27:19 +0200 Subject: [PATCH 21/21] Fixing unallocated vector error (thx @Moritz921) --- ugbase/lib_disc/domain_util.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ugbase/lib_disc/domain_util.cpp b/ugbase/lib_disc/domain_util.cpp index d180420a8..af233cc1e 100644 --- a/ugbase/lib_disc/domain_util.cpp +++ b/ugbase/lib_disc/domain_util.cpp @@ -62,7 +62,7 @@ void LoadDomain(TDomain& domain, const char* filename, int procId) if(additionalSHNames.size()>0){ SmartPtr sh; - vector> ash; + vector> ash(additionalSHNames.size()); for(size_t i_name = 0; i_name < additionalSHNames.size(); ++i_name){ SmartPtr sh = domain.additional_subset_handler(additionalSHNames[i_name]); ash[i_name]= sh;