Skip to content

Commit

Permalink
Fix variable is_sbm to template variable
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewgorgi committed Dec 12, 2024
1 parent cd59e08 commit c39b60b
Show file tree
Hide file tree
Showing 13 changed files with 253 additions and 140 deletions.
43 changes: 27 additions & 16 deletions kratos/geometries/brep_curve_on_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ namespace Kratos
* @ingroup KratosCore
* @brief The BrepCurveOnSurface acts as topology for curves on surfaces.
*/
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType>
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType >
class BrepCurveOnSurface
: public Geometry<typename TContainerPointType::value_type>
{
Expand Down Expand Up @@ -153,7 +153,7 @@ class BrepCurveOnSurface
/// Copy constructor from a geometry with different point type.
template<class TOtherContainerPointType, class TOtherContainerPointEmbeddedType>
explicit BrepCurveOnSurface(
BrepCurveOnSurface<TOtherContainerPointType, TOtherContainerPointEmbeddedType> const& rOther )
BrepCurveOnSurface<TOtherContainerPointType, TShiftedBoundary, TOtherContainerPointEmbeddedType> const& rOther )
: BaseType( rOther )
, mpCurveOnSurface(rOther.mpCurveOnSurface)
, mCurveNurbsInterval(rOther.mCurveNurbsInterval)
Expand All @@ -180,7 +180,7 @@ class BrepCurveOnSurface

/// Assignment operator for geometries with different point type.
template<class TOtherContainerPointType, class TOtherContainerPointEmbeddedType>
BrepCurveOnSurface& operator=( BrepCurveOnSurface<TOtherContainerPointType, TOtherContainerPointEmbeddedType> const & rOther )
BrepCurveOnSurface& operator=( BrepCurveOnSurface<TOtherContainerPointType, TShiftedBoundary, TOtherContainerPointEmbeddedType> const & rOther )
{
BaseType::operator=( rOther );
mpCurveOnSurface = rOther.mpCurveOnSurface;
Expand Down Expand Up @@ -324,8 +324,14 @@ class BrepCurveOnSurface
*/
void SpansLocalSpace(std::vector<double>& rSpans, IndexType DirectionIndex = 0) const override
{
mpCurveOnSurface->SpansLocalSpace(rSpans,
mCurveNurbsInterval.GetT0(), mCurveNurbsInterval.GetT1());
if constexpr (TShiftedBoundary) {
mpCurveOnSurface->SpansLocalSpaceSBM(rSpans,
mCurveNurbsInterval.GetT0(), mCurveNurbsInterval.GetT1());
} else {
mpCurveOnSurface->SpansLocalSpace(rSpans,
mCurveNurbsInterval.GetT0(), mCurveNurbsInterval.GetT1());
}

}

///@}
Expand Down Expand Up @@ -559,9 +565,14 @@ class BrepCurveOnSurface
const IntegrationPointsArrayType& rIntegrationPoints,
IntegrationInfo& rIntegrationInfo) override
{
mpCurveOnSurface->CreateQuadraturePointGeometries(
rResultGeometries, NumberOfShapeFunctionDerivatives, rIntegrationPoints, rIntegrationInfo);

if constexpr (TShiftedBoundary) {
mpCurveOnSurface->CreateQuadraturePointGeometriesSBM(
rResultGeometries, NumberOfShapeFunctionDerivatives, rIntegrationPoints, rIntegrationInfo);
} else {
mpCurveOnSurface->CreateQuadraturePointGeometries(
rResultGeometries, NumberOfShapeFunctionDerivatives, rIntegrationPoints, rIntegrationInfo);
}

for (IndexType i = 0; i < rResultGeometries.size(); ++i) {
rResultGeometries(i)->SetGeometryParent(this);
}
Expand Down Expand Up @@ -674,14 +685,14 @@ class BrepCurveOnSurface
///@{

/// input stream functions
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType> inline std::istream& operator >> (
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType> inline std::istream& operator >> (
std::istream& rIStream,
BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType>& rThis );
BrepCurveOnSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>& rThis );

/// output stream functions
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType> inline std::ostream& operator << (
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType> inline std::ostream& operator << (
std::ostream& rOStream,
const BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType>& rThis )
const BrepCurveOnSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>& rThis )
{
rThis.PrintInfo( rOStream );
rOStream << std::endl;
Expand All @@ -693,14 +704,14 @@ template<class TContainerPointType, class TContainerPointEmbeddedType = TContain
///@name Static Type Declarations
///@{

template<class TContainerPointType, class TContainerPointEmbeddedType> const
GeometryData BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType>::msGeometryData(
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType> const
GeometryData BrepCurveOnSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>::msGeometryData(
&msGeometryDimension,
GeometryData::IntegrationMethod::GI_GAUSS_1,
{}, {}, {});

template<class TContainerPointType, class TContainerPointEmbeddedType>
const GeometryDimension BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType>::msGeometryDimension(3, 1);
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType>
const GeometryDimension BrepCurveOnSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>::msGeometryDimension(3, 1);

///@}
}// namespace Kratos.
Expand Down
38 changes: 24 additions & 14 deletions kratos/geometries/brep_surface.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace Kratos
* @brief The BrepSurface acts as topology for faces. Those
* can be enclosed by a certain set of brep face curves.
*/
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType>
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType>
class BrepSurface
: public Geometry<typename TContainerPointType::value_type>
{
Expand All @@ -60,7 +60,7 @@ class BrepSurface
typedef GeometryData::IntegrationMethod IntegrationMethod;

typedef NurbsSurfaceGeometry<3, TContainerPointType> NurbsSurfaceType;
typedef BrepCurveOnSurface<TContainerPointType, TContainerPointEmbeddedType> BrepCurveOnSurfaceType;
typedef BrepCurveOnSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType> BrepCurveOnSurfaceType;

typedef DenseVector<typename BrepCurveOnSurfaceType::Pointer> BrepCurveOnSurfaceArrayType;
typedef DenseVector<typename BrepCurveOnSurfaceType::Pointer> BrepCurveOnSurfaceLoopType;
Expand Down Expand Up @@ -134,7 +134,7 @@ class BrepSurface
/// Copy constructor from a geometry with different point type.
template<class TOtherContainerPointType, class TOtherContainerPointEmbeddedType>
explicit BrepSurface(
BrepSurface<TOtherContainerPointType, TOtherContainerPointEmbeddedType> const& rOther )
BrepSurface<TOtherContainerPointType, TShiftedBoundary, TOtherContainerPointEmbeddedType> const& rOther )
: BaseType( rOther )
, mpNurbsSurface(rOther.mpNurbsSurface)
, mOuterLoopArray(rOther.mOuterLoopArray)
Expand Down Expand Up @@ -165,7 +165,7 @@ class BrepSurface

/// Assignment operator for geometries with different point type.
template<class TOtherContainerPointType, class TOtherContainerPointEmbeddedType>
BrepSurface& operator=( BrepSurface<TOtherContainerPointType, TOtherContainerPointEmbeddedType> const & rOther )
BrepSurface& operator=( BrepSurface<TOtherContainerPointType, TShiftedBoundary, TOtherContainerPointEmbeddedType> const & rOther )
{
BaseType::operator=( rOther );
mpNurbsSurface = rOther.mpNurbsSurface;
Expand Down Expand Up @@ -435,9 +435,19 @@ class BrepSurface
IntegrationInfo& rIntegrationInfo) const override
{
if (!mIsTrimmed) {
mpNurbsSurface->CreateIntegrationPoints(
rIntegrationPoints, rIntegrationInfo);
// sbm case
if constexpr (TShiftedBoundary) {
// TODO: Next PR -> Call "BrepSBMUtilities::CreateBrepSurfaceSBMIntegrationPoints"
mpNurbsSurface->CreateIntegrationPoints(
rIntegrationPoints, rIntegrationInfo);
}
// body-fitted case
else {
mpNurbsSurface->CreateIntegrationPoints(
rIntegrationPoints, rIntegrationInfo);
}
}
// trimmed case
else
{
std::vector<double> spans_u;
Expand Down Expand Up @@ -605,14 +615,14 @@ class BrepSurface
///@{

/// input stream functions
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType> inline std::istream& operator >> (
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType> inline std::istream& operator >> (
std::istream& rIStream,
BrepSurface<TContainerPointType, TContainerPointEmbeddedType>& rThis );
BrepSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>& rThis );

/// output stream functions
template<class TContainerPointType, class TContainerPointEmbeddedType = TContainerPointType> inline std::ostream& operator << (
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType = TContainerPointType> inline std::ostream& operator << (
std::ostream& rOStream,
const BrepSurface<TContainerPointType, TContainerPointEmbeddedType>& rThis )
const BrepSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>& rThis )
{
rThis.PrintInfo( rOStream );
rOStream << std::endl;
Expand All @@ -624,14 +634,14 @@ template<class TContainerPointType, class TContainerPointEmbeddedType = TContain
///@name Static Type Declarations
///@{

template<class TContainerPointType, class TContainerPointEmbeddedType> const
GeometryData BrepSurface<TContainerPointType, TContainerPointEmbeddedType>::msGeometryData(
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType> const
GeometryData BrepSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>::msGeometryData(
&msGeometryDimension,
GeometryData::IntegrationMethod::GI_GAUSS_1,
{}, {}, {});

template<class TContainerPointType, class TContainerPointEmbeddedType>
const GeometryDimension BrepSurface<TContainerPointType, TContainerPointEmbeddedType>::msGeometryDimension(3, 2);
template<class TContainerPointType, bool TShiftedBoundary, class TContainerPointEmbeddedType>
const GeometryDimension BrepSurface<TContainerPointType, TShiftedBoundary, TContainerPointEmbeddedType>::msGeometryDimension(3, 2);

///@}
}// namespace Kratos.
Expand Down
Loading

0 comments on commit c39b60b

Please sign in to comment.