Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mStrainSize and mSpaceDimension by nature are positive integer types #11784

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions kratos/includes/constitutive_law.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ class KRATOS_API(KRATOS_CORE) ConstitutiveLaw : public Flags
* its variables will be used to check constitutive law and element compatibility

* @param mOptions flags with the current constitutive law characteristics
* @param mStrainSize double with the strain vector size
* @param mStrainSize SizeType with the strain vector size
* @param mStrainMeasures vector with the strain measures accepted by the constitutive law

*/

Flags mOptions;
double mStrainSize;
double mSpaceDimension;
SizeType mStrainSize;
SizeType mSpaceDimension;
std::vector< StrainMeasure > mStrainMeasures;

/**
Expand All @@ -168,18 +168,18 @@ class KRATOS_API(KRATOS_CORE) ConstitutiveLaw : public Flags
}

// Set variables
void SetOptions (const Flags& rOptions) {mOptions=rOptions;};
void SetStrainSize (const double StrainSize) {mStrainSize=StrainSize;};
void SetSpaceDimension(const double SpaceDimension) {mSpaceDimension=SpaceDimension;};
void SetStrainMeasure (const StrainMeasure Measure) {mStrainMeasures.push_back(Measure);};
void SetOptions (const Flags& rOptions) {mOptions=rOptions;};
void SetStrainSize (const SizeType StrainSize) {mStrainSize=StrainSize;};
void SetSpaceDimension (const SizeType SpaceDimension) {mSpaceDimension=SpaceDimension;};
void SetStrainMeasure (const StrainMeasure Measure) {mStrainMeasures.push_back(Measure);};

void SetStrainMeasures (const std::vector<StrainMeasure> MeasuresVector) {mStrainMeasures = MeasuresVector;};

// Get variables
const Flags& GetOptions () {return mOptions;};

const double& GetStrainSize() {return mStrainSize;};
const double& GetSpaceDimension() {return mSpaceDimension;};
const SizeType& GetStrainSize() {return mStrainSize;};
const SizeType& GetSpaceDimension() {return mSpaceDimension;};
std::vector<StrainMeasure>& GetStrainMeasures() {return mStrainMeasures;};
};

Expand Down
6 changes: 3 additions & 3 deletions kratos/python/add_constitutive_law_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace Kratos::Python
{
namespace py = pybind11;

using SizeType = std::size_t;
typedef ConstitutiveLaw ConstitutiveLawBaseType;
template<class TVariableType> bool ConstitutiveLawHas(ConstitutiveLaw& rThisConstitutiveLaw, TVariableType const& rThisVariable) { return rThisConstitutiveLaw.Has(rThisVariable); }

Expand Down Expand Up @@ -58,8 +59,8 @@ void NewInterfaceCalculateMaterialResponse(ConstitutiveLaw& rThisConstitutiveLaw
{rThisConstitutiveLaw.CalculateMaterialResponse (rValues,rStressMeasure);}

Flags GetFeaturesOptions(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetOptions();}
double GetStrainSizeFeatures(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetStrainSize();}
double GetSpaceDimensionFeatures(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetSpaceDimension();}
SizeType GetStrainSizeFeatures(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetStrainSize();}
SizeType GetSpaceDimensionFeatures(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetSpaceDimension();}
std::vector<ConstitutiveLaw::StrainMeasure>& GetStrainMeasuresFeatures(ConstitutiveLaw::Features& rThisFeatures){ return rThisFeatures.GetStrainMeasures(); }

Flags GetLawOptions(ConstitutiveLaw::Parameters& rThisParameters){ return rThisParameters.GetOptions();}
Expand Down Expand Up @@ -162,7 +163,6 @@ void AddConstitutiveLawToPython(pybind11::module& m)
.def("GetStressMeasure",&ConstitutiveLaw::GetStressMeasure)
.def("IsIncremental",&ConstitutiveLaw::IsIncremental)
.def("WorkingSpaceDimension",&ConstitutiveLaw::WorkingSpaceDimension)
.def("GetStrainSize",&ConstitutiveLaw::GetStrainSize)
.def("Has", &ConstitutiveLawHas< Variable<bool> >)
.def("Has", &ConstitutiveLawHas< Variable<int> >)
.def("Has", &ConstitutiveLawHas< Variable<double> >)
Expand Down
Loading