Skip to content

Commit

Permalink
[Core] Add Calculate methods for int and array_1d<double,6> in Condit…
Browse files Browse the repository at this point in the history
…ion and Element (#12970)

* Add Calculate methods for int and array_1d<double,6> in Condition and Element classes

* exposing method to python

---------

Co-authored-by: Daniel Diez <[email protected]>
  • Loading branch information
ddiezrod and Daniel Diez authored Dec 31, 2024
1 parent c64a7b4 commit 4418d33
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
11 changes: 11 additions & 0 deletions kratos/includes/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,11 @@ class Condition : public GeometricalObject
* the Output is given on integration points and characterizes the condition
* Calculate(..) methods are: OPTIONAL
*/
virtual void Calculate(const Variable<int >& rVariable,
int& Output,
const ProcessInfo& rCurrentProcessInfo)
{
}

virtual void Calculate(const Variable<double >& rVariable,
double& Output,
Expand All @@ -682,6 +687,12 @@ class Condition : public GeometricalObject
{
}

virtual void Calculate(const Variable< array_1d<double,6> >& rVariable,
array_1d<double,6>& Output,
const ProcessInfo& rCurrentProcessInfo)
{
}

virtual void Calculate(const Variable<Vector >& rVariable,
Vector& Output,
const ProcessInfo& rCurrentProcessInfo)
Expand Down
11 changes: 11 additions & 0 deletions kratos/includes/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,11 @@ class Element : public GeometricalObject
* the Output is given on integration points and characterizes the element
* Calculate(..) methods are: OPTIONAL
*/
virtual void Calculate(const Variable<int>& rVariable,
int& Output,
const ProcessInfo& rCurrentProcessInfo)
{
}

virtual void Calculate(const Variable<double>& rVariable,
double& Output,
Expand All @@ -695,6 +700,12 @@ class Element : public GeometricalObject
{
}

virtual void Calculate(const Variable<array_1d<double, 6 > >& rVariable,
array_1d<double, 6 > & Output,
const ProcessInfo& rCurrentProcessInfo)
{
}

virtual void Calculate(const Variable<Vector >& rVariable,
Vector& Output,
const ProcessInfo& rCurrentProcessInfo)
Expand Down
4 changes: 4 additions & 0 deletions kratos/python/add_mesh_to_python.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -483,8 +483,10 @@ void AddMeshToPython(pybind11::module& m)
.def("SetValuesOnIntegrationPoints", SetValuesOnIntegrationPointsArray1d<Element, 6>)
.def("SetValuesOnIntegrationPoints", SetValuesOnIntegrationPointsArray1d<Element, 9>)
.def("ResetConstitutiveLaw", &Element::ResetConstitutiveLaw)
.def("Calculate", &EntityCalculateInterface<Element, int>)
.def("Calculate", &EntityCalculateInterface<Element, double>)
.def("Calculate", &EntityCalculateInterface<Element, array_1d<double,3> >)
.def("Calculate", &EntityCalculateInterface<Element, array_1d<double,6> >)
.def("Calculate", &EntityCalculateInterface<Element, Vector >)
.def("Calculate", &EntityCalculateInterface<Element, Matrix >)
.def("CalculateLumpedMassVector", &ElementCalculateLumpedMassVector)
Expand Down Expand Up @@ -639,8 +641,10 @@ void AddMeshToPython(pybind11::module& m)
// .def(SolutionStepVariableIndexingPython<Condition, Variable<array_1d<double, 3> > >())
// .def(SolutionStepVariableIndexingPython<Condition, Variable<vector<double> > >())
// .def(SolutionStepVariableIndexingPython<Condition, Variable<DenseMatrix<double> > >())
.def("Calculate", &EntityCalculateInterface<Condition, int>)
.def("Calculate", &EntityCalculateInterface<Condition, double>)
.def("Calculate", &EntityCalculateInterface<Condition, array_1d<double,3> >)
.def("Calculate", &EntityCalculateInterface<Condition, array_1d<double,6> >)
.def("Calculate", &EntityCalculateInterface<Condition, Vector >)
.def("Calculate", &EntityCalculateInterface<Condition, Matrix >)

Expand Down

0 comments on commit 4418d33

Please sign in to comment.