Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F63682253
model_extensions.hh
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Tue, May 21, 20:01
Size
3 KB
Mime Type
text/x-c++
Expires
Thu, May 23, 20:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17768609
Attached To
rTAMAAS tamaas
model_extensions.hh
View Options
/**
* @file
* @section LICENSE
*
* Copyright (©) 2016-19 EPFL (École Polytechnique Fédérale de Lausanne),
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#include "model.hh"
#include "functional.hh"
#include "model_dumper.hh"
#include "residual.hh"
#include "wrap.hh"
#include <pybind11/pybind11.h>
/* -------------------------------------------------------------------------- */
namespace
tamaas
{
/* -------------------------------------------------------------------------- */
namespace
functional
{
namespace
wrap
{
/// Class for extension of Functional in python
class
PyFunctional
:
public
Functional
{
public
:
using
Functional
::
Functional
;
// Overriding pure virtual functions
Real
computeF
(
GridBase
<
Real
>&
variable
,
GridBase
<
Real
>&
dual
)
const
override
{
PYBIND11_OVERLOAD_PURE
(
Real
,
Functional
,
computeF
,
variable
,
dual
);
}
void
computeGradF
(
GridBase
<
Real
>&
variable
,
GridBase
<
Real
>&
gradient
)
const
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Functional
,
computeGradF
,
variable
,
gradient
);
}
};
}
// namespace wrap
}
// namespace functional
/* -------------------------------------------------------------------------- */
namespace
wrap
{
/* -------------------------------------------------------------------------- */
class
PyModelDumper
:
public
ModelDumper
{
public
:
using
ModelDumper
::
ModelDumper
;
void
dump
(
const
Model
&
model
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
ModelDumper
,
dump
,
model
);
}
};
/* -------------------------------------------------------------------------- */
class
PyResidual
:
public
Residual
{
public
:
using
Residual
::
Residual
;
void
computeResidual
(
GridBase
<
Real
>&
strain_increment
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Residual
,
computeResidual
,
strain_increment
);
}
void
applyTangent
(
GridBase
<
Real
>&
output
,
GridBase
<
Real
>&
input
,
GridBase
<
Real
>&
current_strain_increment
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Residual
,
applyTangent
,
output
,
input
,
current_strain_increment
);
}
void
computeStress
(
GridBase
<
Real
>&
strain_increment
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Residual
,
computeStress
,
strain_increment
);
}
void
updateState
(
GridBase
<
Real
>&
converged_strain_increment
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Residual
,
updateState
,
converged_strain_increment
);
}
const
GridBase
<
Real
>&
getVector
()
const
override
{
PYBIND11_OVERLOAD_PURE
(
const
GridBase
<
Real
>&
,
Residual
,
getVector
);
}
const
GridBase
<
Real
>&
getPlasticStrain
()
const
override
{
PYBIND11_OVERLOAD_PURE
(
const
GridBase
<
Real
>&
,
Residual
,
getPlasticStrain
);
}
const
GridBase
<
Real
>&
getStress
()
const
override
{
PYBIND11_OVERLOAD_PURE
(
const
GridBase
<
Real
>&
,
Residual
,
getStress
);
}
void
computeResidualDisplacement
(
GridBase
<
Real
>&
strain_increment
)
override
{
PYBIND11_OVERLOAD_PURE
(
void
,
Residual
,
computeResidualDisplacement
,
strain_increment
);
}
};
/* -------------------------------------------------------------------------- */
}
// namespace wrap
/* -------------------------------------------------------------------------- */
}
// namespace tamaas
Event Timeline
Log In to Comment