From 574bffdfb17ba0c2b52db1da2b7b75b805f2c7e5 Mon Sep 17 00:00:00 2001 From: Arne Morten Kvarving Date: Thu, 31 Aug 2023 14:08:56 +0200 Subject: [PATCH] ASMbase::getElementCoordinates: add flag to force integration basis required as this is used to obtain coordinates for integration elements in CFL calculations and in ASMu2D evalPoint --- src/ASM/ASMbase.h | 4 +++- src/ASM/ASMs1D.C | 2 +- src/ASM/ASMs1D.h | 2 +- src/ASM/ASMs1DLag.C | 2 +- src/ASM/ASMs1DLag.h | 2 +- src/ASM/ASMs2D.C | 4 ++-- src/ASM/ASMs2D.h | 3 ++- src/ASM/ASMs2DLag.C | 2 +- src/ASM/ASMs2DLag.h | 2 +- src/ASM/ASMs3D.C | 2 +- src/ASM/ASMs3D.h | 2 +- src/ASM/ASMs3DLag.C | 2 +- src/ASM/ASMs3DLag.h | 2 +- src/ASM/ASMs3Dmx.C | 2 +- src/ASM/ASMs3Dmx.h | 2 +- src/ASM/ASMsupel.C | 2 +- src/ASM/ASMsupel.h | 2 +- src/ASM/LR/ASMu2D.C | 4 ++-- src/ASM/LR/ASMu2D.h | 2 +- src/ASM/LR/ASMu3D.C | 2 +- src/ASM/LR/ASMu3D.h | 2 +- 21 files changed, 26 insertions(+), 23 deletions(-) diff --git a/src/ASM/ASMbase.h b/src/ASM/ASMbase.h index da06c892..1d9ba44b 100644 --- a/src/ASM/ASMbase.h +++ b/src/ASM/ASMbase.h @@ -233,9 +233,11 @@ public: virtual void getNodalCoordinates(Matrix& X) const = 0; //! \brief Returns a matrix with nodal coordinates for an element. //! \param[in] iel 1-based element index local to current patch + //! \param[in] forceItg If true force returning integration basis coordinates //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const = 0; + virtual bool getElementCoordinates(Matrix& X, int iel, + bool forceItg = false) const = 0; //! \brief Finds the global (or patch-local) node numbers on a patch boundary. //! \param[in] lIndex Local index of the boundary face/edge diff --git a/src/ASM/ASMs1D.C b/src/ASM/ASMs1D.C index 74d5448a..362f9fe1 100644 --- a/src/ASM/ASMs1D.C +++ b/src/ASM/ASMs1D.C @@ -652,7 +652,7 @@ Tensor ASMs1D::getRotation (size_t inod) const } -bool ASMs1D::getElementCoordinates (Matrix& X, int iel) const +bool ASMs1D::getElementCoordinates (Matrix& X, int iel, bool) const { return this->getElementCoordinates(X,iel,MNPC,curv); } diff --git a/src/ASM/ASMs1D.h b/src/ASM/ASMs1D.h index 30114f66..d730334c 100644 --- a/src/ASM/ASMs1D.h +++ b/src/ASM/ASMs1D.h @@ -87,7 +87,7 @@ public: //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element //! \param[in] iel Element index - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = false) const; //! \brief Returns a matrix with nodal coordinates for an element. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs1DLag.C b/src/ASM/ASMs1DLag.C index 88f18260..ffcbc71e 100644 --- a/src/ASM/ASMs1DLag.C +++ b/src/ASM/ASMs1DLag.C @@ -130,7 +130,7 @@ Vec3 ASMs1DLag::getCoord (size_t inod) const } -bool ASMs1DLag::getElementCoordinates (Matrix& X, int iel) const +bool ASMs1DLag::getElementCoordinates (Matrix& X, int iel, bool) const { if (iel < 1 || (size_t)iel > MNPC.size()) { diff --git a/src/ASM/ASMs1DLag.h b/src/ASM/ASMs1DLag.h index 4ab15ae9..9414f225 100644 --- a/src/ASM/ASMs1DLag.h +++ b/src/ASM/ASMs1DLag.h @@ -55,7 +55,7 @@ public: //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element //! \param[in] iel Element index - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = true) const; //! \brief Returns a matrix with all nodal coordinates within the patch. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs2D.C b/src/ASM/ASMs2D.C index a6e91906..e99907f9 100644 --- a/src/ASM/ASMs2D.C +++ b/src/ASM/ASMs2D.C @@ -1353,7 +1353,7 @@ Vec3 ASMs2D::getCoord (size_t inod) const } -bool ASMs2D::getElementCoordinates (Matrix& X, int iel) const +bool ASMs2D::getElementCoordinates (Matrix& X, int iel, bool forceItg) const { #ifdef INDEX_CHECK if (iel < 1 || (size_t)iel > MNPC.size()) @@ -1364,7 +1364,7 @@ bool ASMs2D::getElementCoordinates (Matrix& X, int iel) const } #endif - const Go::SplineSurface* geo = this->getBasis(ASM::GEOMETRY_BASIS); + const Go::SplineSurface* geo = forceItg ? surf : this->getBasis(ASM::GEOMETRY_BASIS); int lnod0 = this->getFirstItgElmNode(); if (geo != surf) { diff --git a/src/ASM/ASMs2D.h b/src/ASM/ASMs2D.h index 101d3dbb..95ed2edf 100644 --- a/src/ASM/ASMs2D.h +++ b/src/ASM/ASMs2D.h @@ -241,7 +241,8 @@ public: //! \param[in] iel Element index //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + //! \param[in] forceItg If true return integration basis element coordinates + virtual bool getElementCoordinates(Matrix& X, int iel, bool forceItg = false) const; //! \brief Returns a matrix with all nodal coordinates within the patch. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs2DLag.C b/src/ASM/ASMs2DLag.C index 05fa032d..66498126 100644 --- a/src/ASM/ASMs2DLag.C +++ b/src/ASM/ASMs2DLag.C @@ -221,7 +221,7 @@ void ASMs2DLag::setCoord (size_t inod, const Vec3& Xnod) } -bool ASMs2DLag::getElementCoordinates (Matrix& X, int iel) const +bool ASMs2DLag::getElementCoordinates (Matrix& X, int iel, bool) const { if (iel < 1 || (size_t)iel > MNPC.size()) { diff --git a/src/ASM/ASMs2DLag.h b/src/ASM/ASMs2DLag.h index 14cdf748..ec189556 100644 --- a/src/ASM/ASMs2DLag.h +++ b/src/ASM/ASMs2DLag.h @@ -111,7 +111,7 @@ public: //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element //! \param[in] iel Element index - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = true) const; //! \brief Returns a matrix with all nodal coordinates within the patch. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs3D.C b/src/ASM/ASMs3D.C index 6e4c04ab..c35fddd7 100644 --- a/src/ASM/ASMs3D.C +++ b/src/ASM/ASMs3D.C @@ -1622,7 +1622,7 @@ Vec3 ASMs3D::getCoord (size_t inod) const } -bool ASMs3D::getElementCoordinates (Matrix& X, int iel) const +bool ASMs3D::getElementCoordinates (Matrix& X, int iel, bool) const { #ifdef INDEX_CHECK if (iel < 1 || (size_t)iel > MNPC.size()) diff --git a/src/ASM/ASMs3D.h b/src/ASM/ASMs3D.h index ac1c474f..b70f6fd8 100644 --- a/src/ASM/ASMs3D.h +++ b/src/ASM/ASMs3D.h @@ -256,7 +256,7 @@ public: //! \param[in] iel Element index //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = false) const; //! \brief Returns a matrix with all nodal coordinates within the patch. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs3DLag.C b/src/ASM/ASMs3DLag.C index 99a8b37f..bf7eb048 100644 --- a/src/ASM/ASMs3DLag.C +++ b/src/ASM/ASMs3DLag.C @@ -246,7 +246,7 @@ void ASMs3DLag::setCoord (size_t inod, const Vec3& Xnod) } -bool ASMs3DLag::getElementCoordinates (Matrix& X, int iel) const +bool ASMs3DLag::getElementCoordinates (Matrix& X, int iel, bool) const { if (iel < 1 || (size_t)iel > MNPC.size()) { diff --git a/src/ASM/ASMs3DLag.h b/src/ASM/ASMs3DLag.h index 04c47a09..a8ca0bc8 100644 --- a/src/ASM/ASMs3DLag.h +++ b/src/ASM/ASMs3DLag.h @@ -111,7 +111,7 @@ public: //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element //! \param[in] iel Element index - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = true) const; //! \brief Returns a matrix with all nodal coordinates within the patch. //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes diff --git a/src/ASM/ASMs3Dmx.C b/src/ASM/ASMs3Dmx.C index 1a0f1f85..63a1edcf 100644 --- a/src/ASM/ASMs3Dmx.C +++ b/src/ASM/ASMs3Dmx.C @@ -391,7 +391,7 @@ void ASMs3Dmx::closeBoundaries (int dir, int, int) } -bool ASMs3Dmx::getElementCoordinates (Matrix& X, int iel) const +bool ASMs3Dmx::getElementCoordinates (Matrix& X, int iel, bool) const { #ifdef INDEX_CHECK if (iel < 1 || (size_t)iel > MNPC.size()) diff --git a/src/ASM/ASMs3Dmx.h b/src/ASM/ASMs3Dmx.h index 0ceac55c..1ffec5ed 100644 --- a/src/ASM/ASMs3Dmx.h +++ b/src/ASM/ASMs3Dmx.h @@ -66,7 +66,7 @@ public: //! \param[in] iel Element index //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = true) const; //! \brief Returns the global coordinates for the given node. //! \param[in] inod 1-based node index local to current patch diff --git a/src/ASM/ASMsupel.C b/src/ASM/ASMsupel.C index f45ab111..82b5758e 100644 --- a/src/ASM/ASMsupel.C +++ b/src/ASM/ASMsupel.C @@ -197,7 +197,7 @@ void ASMsupel::getNodalCoordinates (Matrix& X) const } -bool ASMsupel::getElementCoordinates (Matrix& X, int iel) const +bool ASMsupel::getElementCoordinates (Matrix& X, int iel, bool) const { if (iel != 1) return false; diff --git a/src/ASM/ASMsupel.h b/src/ASM/ASMsupel.h index 08386859..363b8a74 100644 --- a/src/ASM/ASMsupel.h +++ b/src/ASM/ASMsupel.h @@ -66,7 +66,7 @@ public: //! \param[in] iel 1-based element index local to current patch //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = false) const; //! \brief Finds the global (or patch-local) node numbers on a patch boundary. //! \param[in] lIndex Local index of the boundary face/edge diff --git a/src/ASM/LR/ASMu2D.C b/src/ASM/LR/ASMu2D.C index bcf3fbe1..a882bc49 100644 --- a/src/ASM/LR/ASMu2D.C +++ b/src/ASM/LR/ASMu2D.C @@ -974,7 +974,7 @@ bool ASMu2D::getCoordinates (Matrix& X, unsigned char nsd, } -bool ASMu2D::getElementCoordinates (Matrix& X, int iel) const +bool ASMu2D::getElementCoordinates (Matrix& X, int iel, bool) const { #ifdef INDEX_CHECK if (iel < 1 || iel > lrspline->nElements()) @@ -1909,7 +1909,7 @@ int ASMu2D::evalPoint (int iel, const double* param, Vec3& X) const return -1; Matrix Xnod; - if (!this->getElementCoordinates(Xnod,1+iel)) + if (!this->getElementCoordinates(Xnod,1+iel,true)) return -1; X = Xnod * fe.N; diff --git a/src/ASM/LR/ASMu2D.h b/src/ASM/LR/ASMu2D.h index 9a2cf0d4..c56e7b5b 100644 --- a/src/ASM/LR/ASMu2D.h +++ b/src/ASM/LR/ASMu2D.h @@ -161,7 +161,7 @@ public: //! \param[in] iel 1-based element index //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = false) const; //! \brief Obtain element neighbours. virtual void getElmConnectivities(IntMat& neighs) const; diff --git a/src/ASM/LR/ASMu3D.C b/src/ASM/LR/ASMu3D.C index ee0efad9..e145d1a6 100644 --- a/src/ASM/LR/ASMu3D.C +++ b/src/ASM/LR/ASMu3D.C @@ -705,7 +705,7 @@ double ASMu3D::getParametricVolume (int iel) const } -bool ASMu3D::getElementCoordinates (Matrix& X, int iel) const +bool ASMu3D::getElementCoordinates (Matrix& X, int iel, bool) const { #ifdef INDEX_CHECK if (iel < 1 || (size_t)iel > MNPC.size()) diff --git a/src/ASM/LR/ASMu3D.h b/src/ASM/LR/ASMu3D.h index 8e229835..13e5dbb4 100644 --- a/src/ASM/LR/ASMu3D.h +++ b/src/ASM/LR/ASMu3D.h @@ -147,7 +147,7 @@ public: //! \param[in] iel 1-based element index //! \param[out] X 3\f$\times\f$n-matrix, where \a n is the number of nodes //! in one element - virtual bool getElementCoordinates(Matrix& X, int iel) const; + virtual bool getElementCoordinates(Matrix& X, int iel, bool = false) const; //! \brief Obtain element neighbours. virtual void getElmConnectivities(IntMat& neighs) const;