Page MenuHomec4science

surface.cpp
No OneTemporary

File Metadata

Created
Tue, Jul 23, 09:47

surface.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 "isopowerlaw.hh"
#include "surface_generator_filter.hh"
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
/* -------------------------------------------------------------------------- */
namespace wrap {
using namespace py::literals;
/* -------------------------------------------------------------------------- */
template <UInt dim>
void wrapFilter(py::module& mod) {
auto name = makeDimensionName("Filter", dim);
py::class_<Filter<dim>>(mod, name.c_str());
}
/* -------------------------------------------------------------------------- */
template <UInt dim>
void wrapIsopowerlaw(py::module& mod) {
std::string name = makeDimensionName("Isopowerlaw", dim);
py::class_<Isopowerlaw<dim>, Filter<dim>>(mod, name.c_str())
.def(py::init<>())
.def_property("q0", &Isopowerlaw<dim>::getQ0, &Isopowerlaw<dim>::setQ0)
.def_property("q1", &Isopowerlaw<dim>::getQ1, &Isopowerlaw<dim>::setQ1)
.def_property("q2", &Isopowerlaw<dim>::getQ2, &Isopowerlaw<dim>::setQ2)
.def_property("hurst", &Isopowerlaw<dim>::getHurst,
&Isopowerlaw<dim>::setHurst)
.def("rmsHeights", &Isopowerlaw<dim>::rmsHeights)
.def("moments", &Isopowerlaw<dim>::moments)
.def("alpha", &Isopowerlaw<dim>::alpha)
.def("rmsSlopes", &Isopowerlaw<dim>::rmsSlopes);
}
/* -------------------------------------------------------------------------- */
template <UInt dim>
void wrapSurfaceGeneratorFilter(py::module& mod) {
std::string name = makeDimensionName("SurfaceGeneratorFilter", dim);
py::class_<SurfaceGeneratorFilter<dim>>(mod, name.c_str())
.def(py::init<>())
.def("buildSurface", &SurfaceGeneratorFilter<dim>::buildSurface,
"Build rough surface")
.def("setFilter", &SurfaceGeneratorFilter<dim>::setFilter,
"Set PSD filter", "filter"_a)
.def("setSizes",
(void (SurfaceGeneratorFilter<dim>::*)(
const std::array<UInt, dim>&)) &
SurfaceGeneratorFilter<dim>::setSizes)
.def_property("random_seed", &SurfaceGeneratorFilter<dim>::getRandomSeed,
&SurfaceGeneratorFilter<dim>::setRandomSeed);
}
/* -------------------------------------------------------------------------- */
void wrapSurface(py::module& mod) {
wrapFilter<1>(mod);
wrapFilter<2>(mod);
wrapIsopowerlaw<1>(mod);
wrapIsopowerlaw<2>(mod);
wrapSurfaceGeneratorFilter<1>(mod);
wrapSurfaceGeneratorFilter<2>(mod);
}
} // namespace wrap
/* -------------------------------------------------------------------------- */
__END_TAMAAS__

Event Timeline