Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F67263782
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
Fri, Jun 21, 07:33
Size
3 KB
Mime Type
text/x-c++
Expires
Sun, Jun 23, 07:33 (2 d)
Engine
blob
Format
Raw Data
Handle
18334942
Attached To
rTAMAAS tamaas
model_extensions.hh
View Options
/**
* @file
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas 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 Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://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
(
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
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