Page MenuHomec4science

percolation.cpp
No OneTemporary

File Metadata

Created
Wed, May 29, 09:46

percolation.cpp

/**
* @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 "flood_fill.hh"
#include "wrap.hh"
/* -------------------------------------------------------------------------- */
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
namespace wrap {
/* -------------------------------------------------------------------------- */
using namespace py::literals;
/* -------------------------------------------------------------------------- */
template <UInt dim>
void wrapCluster(py::module& mod) {
auto name = makeDimensionName("Cluster", dim);
py::class_<Cluster<dim>>(mod, name.c_str())
.def(py::init<>())
.def("getArea", &Cluster<dim>::getArea, "Area of cluster")
.def("getPoints", &Cluster<dim>::getPoints,
"Get list of points of cluster")
.def("getPerimeter", &Cluster<dim>::getPerimeter,
"Get perimeter of cluster");
}
void wrapPercolation(py::module& mod) {
wrapCluster<2>(mod);
wrapCluster<3>(mod);
py::class_<FloodFill>(mod, "FloodFill")
.def_static("getClusters", &FloodFill::getClusters,
"Return a list of clusters from boolean map", "contact"_a,
"diagonal"_a)
.def_static("getVolumes", &FloodFill::getVolumes,
"Return a list of volume clusters", "map"_a, "diagonal"_a);
}
} // namespace wrap
__END_TAMAAS__

Event Timeline