Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F70128865
core.cpp
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, Jul 5, 10:00
Size
4 KB
Mime Type
text/x-c++
Expires
Sun, Jul 7, 10:00 (2 d)
Engine
blob
Format
Raw Data
Handle
18794760
Attached To
rTAMAAS tamaas
core.cpp
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 "statistics.hh"
#include "surface_statistics.hh"
#include "wrap.hh"
#include <pybind11/stl.h>
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
/* -------------------------------------------------------------------------- */
namespace wrap {
/* -------------------------------------------------------------------------- */
template <UInt dim>
void wrapStatistics(py::module& mod) {
auto name = makeDimensionName("Statistics", dim);
py::class_<Statistics<dim>>(mod, name.c_str())
.def_static("computePowerSpectrum",
&Statistics<dim>::computePowerSpectrum,
py::return_value_policy::move)
.def_static("computeAutocorrelation",
&Statistics<dim>::computeAutocorrelation,
py::return_value_policy::move)
.def_static("computeMoments", &Statistics<dim>::computeMoments)
.def_static("computeSpectralRMSSlope",
&Statistics<dim>::computeSpectralRMSSlope)
.def_static("computeRMSHeights", &Statistics<dim>::computeRMSHeights);
}
/* -------------------------------------------------------------------------- */
void wrapCore(py::module& mod) {
// Exposing SurfaceStatistics (legacy)
py::class_<SurfaceStatistics>(mod, "SurfaceStatistics")
.def_static("computeMaximum", &SurfaceStatistics::computeMaximum)
.def_static("computeMinimum", &SurfaceStatistics::computeMinimum)
.def_static("computeSpectralRMSSlope",
&SurfaceStatistics::computeSpectralRMSSlope)
.def_static("computeRMSSlope", &SurfaceStatistics::computeRMSSlope)
.def_static("computeMoments", &SurfaceStatistics::computeMoments)
.def_static("computeSkewness", &SurfaceStatistics::computeSkewness)
.def_static("computeKurtosis", &SurfaceStatistics::computeKurtosis)
.def_static("computeSpectralMeanCurvature",
&SurfaceStatistics::computeSpectralMeanCurvature)
.def_static("computeSpectralStdev",
&SurfaceStatistics::computeSpectralStdev)
.def_static("computeAnalyticFractalMoment",
&SurfaceStatistics::computeAnalyticFractalMoment)
.def_static("computePerimeter", &SurfaceStatistics::computePerimeter)
.def_static("computeContactArea", &SurfaceStatistics::computeContactArea)
.def_static("computeContactAreaRatio",
&SurfaceStatistics::computeContactAreaRatio)
.def_static("computeSpectralDistribution",
&SurfaceStatistics::computeSpectralDistribution)
.def_static("computeSum", &SurfaceStatistics::computeSum)
.def_static("computeAutocorrelation",
&SurfaceStatistics::computeAutocorrelation,
py::return_value_policy::copy)
.def_static("computePowerSpectrum",
&SurfaceStatistics::computePowerSpectrum,
py::return_value_policy::copy);
wrapStatistics<1>(mod);
wrapStatistics<2>(mod);
mod.def("to_voigt",
[](const Grid<Real, 3>& field) {
if (field.getNbComponents() == 9) {
Grid<Real, 3> voigt(field.sizes(), 6);
Loop::loop([](auto in, auto out) { out.symmetrize(in); },
range<MatrixProxy<const Real, 3, 3>>(field),
range<SymMatrixProxy<Real, 3>>(voigt));
return voigt;
} else
TAMAAS_EXCEPTION("Wrong number of components to symmetrize");
},
"Convert a 3D tensor field to voigt notation",
py::return_value_policy::copy);
}
} // namespace wrap
/* -------------------------------------------------------------------------- */
__END_TAMAAS__
Event Timeline
Log In to Comment