Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F65467113
solvers.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
Tue, Jun 4, 00:26
Size
3 KB
Mime Type
text/x-c
Expires
Thu, Jun 6, 00:26 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
18044690
Attached To
rTAMAAS tamaas
solvers.cpp
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 "wrap.hh"
#include "contact_solver.hh"
#include "polonsky_keer_rey.hh"
#include "kato.hh"
#include "beck_teboulle.hh"
#include "condat.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
namespace wrap {
/* -------------------------------------------------------------------------- */
using namespace py::literals;
/* -------------------------------------------------------------------------- */
void wrapSolvers(py::module& mod) {
py::class_<ContactSolver>(mod, "ContactSolver")
.def(py::init<Model&, const GridBase<Real>&, Real>(), "model"_a,
"surface"_a, "tolerance"_a)
.def("setMaxIterations", &ContactSolver::setMaxIterations, "max_iter"_a)
.def("setDumpFrequency", &ContactSolver::setDumpFrequency, "dump_freq"_a)
.def("addFunctionalTerm", &ContactSolver::addFunctionalTerm);
py::class_<PolonskyKeerRey, ContactSolver> pkr(mod, "PolonskyKeerRey");
pkr.def(py::init<Model&, const GridBase<Real>&, Real, PolonskyKeerRey::type,
PolonskyKeerRey::type>(),
"model"_a, "surface"_a, "tolerance"_a, "primal_type"_a,
"constraint_type"_a, py::keep_alive<1, 2>(), py::keep_alive<1, 3>())
.def("solve", &PolonskyKeerRey::solve, "target"_a)
.def("computeError", &PolonskyKeerRey::computeError);
py::enum_<PolonskyKeerRey::type>(pkr, "type")
.value("gap", PolonskyKeerRey::gap)
.value("pressure", PolonskyKeerRey::pressure)
.export_values();
py::class_<Kato, ContactSolver> kato(mod, "Kato");
kato.def(py::init<Model&, const GridBase<Real>&, Real, Real>(),
"model"_a, "surface"_a, "tolerance"_a, "mu"_a,
py::keep_alive<1, 2>(), py::keep_alive<1, 3>())
.def("solve", &Kato::solve, "p0"_a, "proj_iter"_a=50)
.def("solveRelaxed", &Kato::solveRelaxed, "g0"_a)
.def("computeCost", &Kato::computeCost);
py::class_<BeckTeboulle, ContactSolver> bt(mod, "BeckTeboulle");
bt.def(py::init<Model&, const GridBase<Real>&, Real, Real>(),
"model"_a, "surface"_a, "tolerance"_a, "mu"_a,
py::keep_alive<1, 2>(), py::keep_alive<1, 3>())
.def("solve", &BeckTeboulle::solve, "p0"_a)
.def("computeCost", &BeckTeboulle::computeCost);
py::class_<Condat, ContactSolver> cd(mod, "Condat");
cd.def(py::init<Model&, const GridBase<Real>&, Real, Real>(),
"model"_a, "surface"_a, "tolerance"_a, "mu"_a,
py::keep_alive<1, 2>(), py::keep_alive<1, 3>())
.def("solve", &Condat::solve, "p0"_a, "grad_step"_a=0.9)
.def("computeCost", &Condat::computeCost);
}
} // namespace wrap
__END_TAMAAS__
Event Timeline
Log In to Comment