Page MenuHomec4science

model.cpp
No OneTemporary

File Metadata

Created
Sat, May 4, 09:08

model.cpp

/**
* @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 "wrap.hh"
#include "model.hh"
#include "model_factory.hh"
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
namespace wrap {
using namespace py::literals;
void wrapModelClass(py::module& mod) {
py::enum_<model_type>(mod, "model_type")
.value("basic_1d", model_type::basic_1d)
.value("basic_2d", model_type::basic_1d)
.value("surface_1d", model_type::surface_1d)
.value("surface_2d", model_type::surface_1d)
.value("volume_1d", model_type::volume_1d)
.value("volume_2d", model_type::volume_1d)
.export_values();
py::class_<Model>(mod, "Model")
.def("setElasticity", &Model::setElasticity, "E"_a, "nu"_a)
.def("getHertzModulus", &Model::getHertzModulus)
.def("getYoungModulus", &Model::getYoungModulus)
.def("getPoissonRatio", &Model::getPoissonRatio)
.def("getTraction", (GridBase<Real> & (Model::*)()) & Model::getTraction)
.def("getDisplacement",
(GridBase<Real> & (Model::*)()) & Model::getDisplacement)
.def("getSystemSize", &Model::getSystemSize)
.def("getDiscretization", &Model::getDiscretization)
.def("solveNeumann", &Model::solveNeumann)
.def("solveDirichlet", &Model::solveDirichlet);
}
void wrapModelFactory(py::module& mod) {
py::class_<ModelFactory>(mod, "ModelFactory")
.def_static("createModel", &ModelFactory::createModel, "model_type"_a,
"system_size"_a, "discretization"_a);
}
void wrapModel(py::module& mod) {
wrapModelClass(mod);
wrapModelFactory(mod);
}
} // namespace wrap
__END_TAMAAS__

Event Timeline