Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/warning_fixes' into warning_fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hverhelst committed Dec 10, 2024
2 parents 5186906 + 6093e29 commit 34f02a8
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 35 deletions.
2 changes: 1 addition & 1 deletion src/gsMaterialMatrixLinear.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class gsMaterialMatrixLinear : public gsMaterialMatrixBaseDim<dim,T>

typedef T Scalar_t;

GISMO_OVERRIDE_CLONE_FUNCTION(gsMaterialMatrixLinear)
GISMO_OVERRIDE_CLONE_FUNCTION(gsMaterialMatrixLinear);

using Base = gsMaterialMatrixBaseDim<dim,T>;

Expand Down
2 changes: 1 addition & 1 deletion src/gsMaterialMatrixNonlinear.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class gsMaterialMatrixNonlinear : public gsMaterialMatrixBaseDim<dim,T>
{
public:

GISMO_OVERRIDE_CLONE_FUNCTION(gsMaterialMatrixNonlinear)
GISMO_OVERRIDE_CLONE_FUNCTION(gsMaterialMatrixNonlinear);

using Base = gsMaterialMatrixBaseDim<dim,T>;

Expand Down
7 changes: 4 additions & 3 deletions src/gsThinShellAssembler.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class gsThinShellAssembler : public gsThinShellAssemblerBase<T>
gsThinShellAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & surface_force,
const gsFunctionSet<T> & surface_force,
const gsMaterialMatrixContainer<T> & materialmatrices);

/**
Expand All @@ -107,7 +107,7 @@ class gsThinShellAssembler : public gsThinShellAssemblerBase<T>
gsThinShellAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & surface_force,
const gsFunctionSet<T> & surface_force,
gsMaterialMatrixBase<T> * materialmatrix);
gsThinShellAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
Expand Down Expand Up @@ -675,7 +675,8 @@ class gsThinShellAssembler : public gsThinShellAssemblerBase<T>

gsSparseMatrix<T> m_mass;

const gsFunction<T> * m_forceFun;
const gsFunctionSet<T> * m_forceFun;
bool m_parametricForce;
const gsFunction<T> * m_foundFun;
const gsFunction<T> * m_pressFun;

Expand Down
95 changes: 65 additions & 30 deletions src/gsThinShellAssembler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ template<short_t d, class T, bool bending>
gsThinShellAssembler<d, T, bending>::gsThinShellAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & surface_force,
const gsFunctionSet<T> & surface_force,
const gsMaterialMatrixContainer<T> & materialMatrices
)
:
Expand All @@ -45,6 +45,9 @@ gsThinShellAssembler<d, T, bending>::gsThinShellAssembler(const gsMultiPatch<T>
m_forceFun(&surface_force),
m_materialMatrices(materialMatrices)
{
// surface forces defined in the parametric domain (ONLY WORKS FOR 3D)
m_parametricForce = (surface_force.domainDim()==2 && d==3);

this->_defaultOptions();
this->_getOptions();
this->_initialize();
Expand All @@ -54,7 +57,7 @@ template<short_t d, class T, bool bending>
gsThinShellAssembler<d, T, bending>::gsThinShellAssembler(const gsMultiPatch<T> & patches,
const gsMultiBasis<T> & basis,
const gsBoundaryConditions<T> & bconditions,
const gsFunction<T> & surface_force,
const gsFunctionSet<T> & surface_force,
typename gsMaterialMatrixBase<T>::uPtr & materialMatrix
)
:
Expand Down Expand Up @@ -83,6 +86,9 @@ gsThinShellAssembler<d, T, bending>::gsThinShellAssembler(const gsMultiPatch<T>
for (size_t p=0; p!=m_patches.nPatches(); p++)
m_materialMatrices.set(p,materialMatrix);

// surface forces defined in the parametric domain (ONLY WORKS FOR 3D)
m_parametricForce = (surface_force.domainDim()==2 && d==3);

this->_defaultOptions();
this->_getOptions();
this->_initialize();
Expand Down Expand Up @@ -409,6 +415,7 @@ void gsThinShellAssembler<d, T, bending>::_assemblePressure(const gsFunction<T>
_assemblePressure_impl<d,_matrix>(pressFun,deformed);
}

// assembles eq 3.26 from http://resolver.tudelft.nl/uuid:56c0cc91-643d-4817-9702-93fedce5fd78
template <short_t d, class T, bool bending>
template <short_t _d, bool matrix>
typename std::enable_if<(_d==3) && matrix, void>::type
Expand All @@ -428,6 +435,7 @@ gsThinShellAssembler<d, T, bending>::_assemblePressure_impl(const gsFunction<T>
);
}

// assembles eq 3.25 from http://resolver.tudelft.nl/uuid:56c0cc91-643d-4817-9702-93fedce5fd78
template <short_t d, class T, bool bending>
template <short_t _d, bool _matrix>
typename std::enable_if<(_d==3) && !_matrix, void>::type
Expand Down Expand Up @@ -467,14 +475,6 @@ template <short_t d, class T, bool bending>
template <short_t _d, bool _matrix>
typename std::enable_if<(_d==3) && _matrix, void>::type
gsThinShellAssembler<d, T, bending>::_assembleFoundation_impl(const gsFunction<T> & /*foundFun*/)
{
// No matrix contribution for the linear case
}

template <short_t d, class T, bool bending>
template <short_t _d, bool _matrix>
typename std::enable_if<(_d==3) && !_matrix, void>::type
gsThinShellAssembler<d, T, bending>::_assembleFoundation_impl(const gsFunction<T> & foundFun)
{
geometryMap m_ori = m_assembler.getMap(m_patches);

Expand All @@ -488,6 +488,15 @@ gsThinShellAssembler<d, T, bending>::_assembleFoundation_impl(const gsFunction<T
);
}

// assembles eq 3.27 from http://resolver.tudelft.nl/uuid:56c0cc91-643d-4817-9702-93fedce5fd78
template <short_t d, class T, bool bending>
template <short_t _d, bool _matrix>
typename std::enable_if<(_d==3) && !_matrix, void>::type
gsThinShellAssembler<d, T, bending>::_assembleFoundation_impl(const gsFunction<T> & foundFun)
{
// No rhs contribution for the linear case
}

template <short_t d, class T, bool bending>
template <short_t _d, bool _matrix>
typename std::enable_if<!(_d==3), void>::type
Expand All @@ -504,6 +513,7 @@ void gsThinShellAssembler<d, T, bending>::_assembleFoundation(const gsFunction<T
_assembleFoundation_impl<d,_matrix>(foundFun,deformed);
}

// assembles eq 3.28 from http://resolver.tudelft.nl/uuid:56c0cc91-643d-4817-9702-93fedce5fd78
template <short_t d, class T, bool bending>
template <short_t _d, bool matrix>
typename std::enable_if<(_d==3) && matrix, void>::type
Expand Down Expand Up @@ -1450,6 +1460,8 @@ ThinShellAssemblerStatus gsThinShellAssembler<d, T, bending>::assembleMass(const
else
m_assembler.assemble(mm0.val()*(m_space.rowSum())*meas(m_ori));

m_mass = m_assembler.matrix();

/* // assemble system
if (!lumped)
{
Expand Down Expand Up @@ -1553,8 +1565,8 @@ gsThinShellAssembler<d, T, bending>::assemble_impl()

space m_space = m_assembler.trialSpace(0);

auto m_force = m_assembler.getCoeff(*m_forceFun, m_ori);

auto m_physforce = m_assembler.getCoeff(*m_forceFun,m_ori); // force defined in physical domain
auto m_parforce = m_assembler.getCoeff(*m_forceFun); // force defined in parametric domain

auto m_Em_der = flat( jac(m_def).tr() * jac(m_space) );
auto m_Ef_der = -( deriv2(m_space,sn(m_def).normalized().tr() ) + deriv2(m_def,var1(m_space,m_def) ) ) * reshape(m_m2,3,3);
Expand All @@ -1581,10 +1593,13 @@ gsThinShellAssembler<d, T, bending>::assemble_impl()
+
m_M_der * m_Ef_der.tr()
) * meas(m_ori)
,
m_space * m_force * meas(m_ori)
);

if (m_parametricForce) // Assemble the force defined in the parameter domain
m_assembler.assemble(m_space * m_parforce * meas(m_ori));
else // Assemble the force defined in the physical domain
m_assembler.assemble(m_space * m_physforce * meas(m_ori));

this->_assembleWeakBCs<true>();
this->_assembleWeakBCs<false>();
this->_assembleWeakIfc<true>();
Expand Down Expand Up @@ -1630,7 +1645,8 @@ gsThinShellAssembler<d, T, bending>::assemble_impl()
auto mmA = m_assembler.getCoeff(m_mmA);

space m_space = m_assembler.trialSpace(0);
auto m_force = m_assembler.getCoeff(*m_forceFun, m_ori);
auto m_physforce = m_assembler.getCoeff(*m_forceFun,m_ori); // force defined in physical domain
auto m_parforce = m_assembler.getCoeff(*m_forceFun); // force defined in parametric domain

auto jacG = jac(m_def);
auto m_Em_der = flat( jacG.tr() * jac(m_space) ) ; //[checked]
Expand All @@ -1653,10 +1669,13 @@ gsThinShellAssembler<d, T, bending>::assemble_impl()
(
m_N_der * m_Em_der.tr()
) * meas(m_ori)
,
m_space * m_force * meas(m_ori)
);

if (m_parametricForce) // Assemble the force defined in the parameter domain
m_assembler.assemble(m_space * m_parforce * meas(m_ori));
else // Assemble the force defined in the physical domain
m_assembler.assemble(m_space * m_physforce * meas(m_ori));

this->_assembleWeakBCs<true>();
this->_assembleWeakBCs<false>();
this->_assembleWeakIfc<true>();
Expand Down Expand Up @@ -1722,10 +1741,6 @@ gsThinShellAssembler<d, T, bending>::assembleMatrix_impl(const gsFunctionSet<T>

this->homogenizeDirichlet();

gsVector<T> pt(2);
pt.setConstant(0.25);
gsExprEvaluator<T> ev(m_assembler);

auto m_N = S0.tr();
auto m_Em_der = flat( jac(m_def).tr() * jac(m_space) ) ; //[checked]
auto m_Em_der2 = flatdot( jac(m_space),jac(m_space).tr(), m_N ); //[checked]
Expand Down Expand Up @@ -1991,7 +2006,8 @@ gsThinShellAssembler<d, T, bending>::assembleVector_impl(const gsFunctionSet<T>
auto m_m2 = m_assembler.getCoeff(mult2t);

space m_space = m_assembler.trialSpace(0);
auto m_force = m_assembler.getCoeff(*m_forceFun, m_ori);
auto m_physforce = m_assembler.getCoeff(*m_forceFun,m_ori); // force defined in physical domain
auto m_parforce = m_assembler.getCoeff(*m_forceFun); // force defined in parametric domain


if (homogenize) this->homogenizeDirichlet();
Expand All @@ -2008,10 +2024,19 @@ gsThinShellAssembler<d, T, bending>::assembleVector_impl(const gsFunctionSet<T>
if (m_foundInd) this->_assembleFoundation<false>(*m_foundFun,deformed);
if (m_pressInd) this->_assemblePressure<false>(*m_pressFun,deformed);

// Assemble vector
m_assembler.assemble(m_space * m_force * meas(m_ori) -
( ( m_N * m_Em_der.tr() + m_M * m_Ef_der.tr() ) * meas(m_ori) ).tr()
);
// Assemble vector
////// External force
if (m_parametricForce) // Assemble the force defined in the parameter domain
m_assembler.assemble(m_space * m_parforce * meas(m_ori));
else // Assemble the force defined in the physical domain
m_assembler.assemble(m_space * m_physforce * meas(m_ori));

////// Internal force
m_assembler.assemble(
(
- ( ( m_N * m_Em_der.tr() + m_M * m_Ef_der.tr() ) * meas(m_ori) ).tr()
)
);

this->_assembleWeakBCs<false>(deformed);
this->_assembleWeakIfc<false>(deformed);
Expand Down Expand Up @@ -2053,7 +2078,8 @@ gsThinShellAssembler<d, T, bending>::assembleVector_impl(const gsFunctionSet<T>
auto S0 = m_assembler.getCoeff(m_S0);

space m_space = m_assembler.trialSpace(0);
auto m_force = m_assembler.getCoeff(*m_forceFun, m_ori);
auto m_physforce = m_assembler.getCoeff(*m_forceFun,m_ori); // force defined in physical domain
auto m_parforce = m_assembler.getCoeff(*m_forceFun); // force defined in parametric domain

if (homogenize) this->homogenizeDirichlet();
else this->_assembleDirichlet();
Expand All @@ -2067,9 +2093,18 @@ gsThinShellAssembler<d, T, bending>::assembleVector_impl(const gsFunctionSet<T>
if (m_pressInd) this->_assemblePressure<false>(*m_pressFun,deformed);

// Assemble vector
m_assembler.assemble(m_space * m_force * meas(m_ori) -
( ( m_N * m_Em_der.tr() ) * meas(m_ori) ).tr()
);
////// External force
if (m_parametricForce) // Assemble the force defined in the parameter domain
m_assembler.assemble(m_space * m_parforce * meas(m_ori));
else // Assemble the force defined in the physical domain
m_assembler.assemble(m_space * m_physforce * meas(m_ori));

////// Internal force
m_assembler.assemble(
(
- ( ( m_N * m_Em_der.tr() ) * meas(m_ori) ).tr()
)
);

this->_assembleWeakBCs<false>(deformed);
this->_assembleWeakIfc<false>(deformed);
Expand Down

0 comments on commit 34f02a8

Please sign in to comment.