diff --git a/extra_packages/contact_alejandro/examples/contact/CMakeLists.txt b/extra_packages/contact_alejandro/examples/contact/CMakeLists.txt deleted file mode 100644 index 699d2ec1e..000000000 --- a/extra_packages/contact_alejandro/examples/contact/CMakeLists.txt +++ /dev/null @@ -1,57 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Alejandro M. Aragón -# -# @date creation: Sun Oct 19 2014 -# -# @brief configuration file for contact examples -# -# @section LICENSE -# -# Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory -# (LSMS - Laboratoire de Simulation en Mécanique des Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -# @section DESCRIPTION -# -#=============================================================================== - -register_example(hertz_2D hertz_2D.cc) - -add_mesh(hertz_2D_mesh hertz_2D.geo 2 1) -add_dependencies(hertz_2D hertz_2D_mesh) - - -register_example(hertz_3D hertz_3D.cc) - -add_mesh(hertz_3D_mesh hertz_3D.geo 3 1) -add_dependencies(hertz_3D hertz_3D_mesh) - - -register_example(tetrahedra tetrahedra.cc) - -add_mesh(tetrahedra_mesh tetrahedra.geo 3 1) -add_dependencies(tetrahedra tetrahedra_mesh) - - -register_example(blocks blocks.cc) - -add_mesh(blocks_mesh blocks.geo 2 1) -add_dependencies(blocks blocks_mesh) - - -#=============================================================================== -file(COPY steel.dat DESTINATION .) \ No newline at end of file diff --git a/extra_packages/contact_alejandro/examples/contact/blocks.cc b/extra_packages/contact_alejandro/examples/contact/blocks.cc deleted file mode 100644 index de9a56829..000000000 --- a/extra_packages/contact_alejandro/examples/contact/blocks.cc +++ /dev/null @@ -1,135 +0,0 @@ -/** - * @file blocks.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Oct 19 2014 - * - * @brief Example of two blocks in contact - * - * @section LICENSE - * - * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory - * (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include -#include - -#include "contact_impl.hh" - -using namespace akantu; - - -using std::cout; -using std::endl; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - typedef std::chrono::high_resolution_clock clock; - typedef std::chrono::seconds seconds; - - typedef SolidMechanicsModel model_type; - - typedef Contact > - contact_type; - - // capture initial time - clock::time_point t0 = clock::now(); - - initialize("steel.dat", argc, argv); - - // create and read mesh - Mesh mesh(dim); - mesh.read("blocks.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); - - // setup paraview dumper - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // get areas for slave nodes - mesh.createGroupsFromMeshData("physical_names"); - model.applyBC(BC::Neumann::FromHigherDim(Matrix::eye(2,1.)), "interface_top"); - Array& areas = model.getForce(); - - ElementGroup &eg = mesh.getElementGroup("interface_top"); - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - - // add slave node - cd.addSlave(*nit); - - // compute and add area - Real a = 0.; - for (UInt i=0; i(cd); - } - - clock::time_point t1 = clock::now(); - - seconds total_s = std::chrono::duration_cast(t1 - t0); - - cout<<"- Simulation took "< - * - * @date creation: Sun Oct 19 2014 - * - * @brief File used to obtain 2D implicit contact results and compare with - * Hertz theory - * - * @section LICENSE - * - * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory - * (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include - -#include "contact_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - -int main(int argc, char *argv[]) { - // set dimension - static const UInt dim = 2; - - typedef Point point_type; - typedef BoundingBox bbox_type; - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - typedef std::chrono::high_resolution_clock clock; - typedef std::chrono::seconds seconds; - - clock::time_point t0 = clock::now(); - - initialize("steel.dat", argc, argv); - - // create mesh - Mesh mesh(dim); - - // read mesh - mesh.read("hertz_2D.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // optimal value of penalty multiplier - cd[Alpha] = 1.e-6; - cd[Verbose] = true; - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // use bounding box to minimize slave-master pairs - Real r0 = 0.5; - Real r1 = 0.15; - point_type c1(-r0 / 2, -r1 / 2); - point_type c2(r0 / 2, r1 / 2); - bbox_type bb(c1, c2); - - // get physical names from mesh - Array &coords = mesh.getNodes(); - mesh.createGroupsFromMeshData ("physical_names"); - - // compute areas for slave nodes that are used for the computation of contact pressures - model.applyBC(BC::Neumann::FromHigherDim(Matrix ::eye(2, 1.)), "contact_surface"); - // NOTE: the areas are computed by assigning a unit pressure to the contact surface, - // then the magnitude of the resulting force vector at nodes gives its associated area - Array & areas = model.getForce(); - - // add slave-master pairs and store slave node areas - ElementGroup &eg = mesh.getElementGroup("contact_surface"); - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - // get point of slave node - point_type n(&coords(*nit)); - - // process only if within bounding box - if (bb & n) { - cd.addSlave(*nit); - - // compute and add area to slave node - Real a = 0.; - for (UInt i = 0; i < dim; ++i) - a += pow(areas(*nit, i), 2.); - cd.addArea(*nit, sqrt(a)); - } - } - - // clear force vector before the start of the simulation - areas.clear(); - - // add master surface to find pairs - cd.searchSurface("rigid"); - - // output contact data info - cout << cd; - - // apply boundary conditions - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "rigid"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "rigid"); - model.getBlockedDOFs()(7, 0) = true; - - Real data[3][50]; // store results for printing - Real step = 0.001; // top displacement increment - Real Delta = 0.05; // maximum imposed displacement - size_t k = 0; - - // loop over displacement increments - for (Real delta = step; delta <= Delta + step; delta += step) { - // apply displacement at the top - model.applyBC(BC::Dirichlet::FixedValue(-delta, _y), "top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - - data[0][k] = delta; - data[1][k] = cd.getForce(); - data[2][k] = cd.getMaxPressure(); - ++k; - } - - // print results - size_t w = 10; - cout << setprecision(2); - cout << "\n\n" << setw(w) << "Disp." << setw(w) << "Force" << setw(w) << "Max pressure" << endl; - for (int i = 0; i < 50; ++i) - cout << setw(w) << data[0][i] << setw(w) << data[1][i] << setw(w) << data[2][i] << endl; - - clock::time_point t1 = clock::now(); - seconds total_s = std::chrono::duration_cast (t1 - t0); - cout << "*** INFO *** Simulation took " << total_s.count() << " s" << endl; - - // finalize simulation - finalize(); - return EXIT_SUCCESS; -} diff --git a/extra_packages/contact_alejandro/examples/contact/hertz_2D.geo b/extra_packages/contact_alejandro/examples/contact/hertz_2D.geo deleted file mode 100644 index 5dfc70800..000000000 --- a/extra_packages/contact_alejandro/examples/contact/hertz_2D.geo +++ /dev/null @@ -1,29 +0,0 @@ -cl1 = 0.01; -cl2 = 0.1; -cl3 = 1; -Dy = 0.1; -Point(1) = {0, 0.1-Dy, 0, cl1}; -Point(2) = {0.5, 0.6-Dy, 0, cl2}; -Point(3) = {-0.5, 0.6-Dy, 0, cl2}; -Point(4) = {0.5, 0, 0, cl3}; -Point(5) = {-0.5, 0, 0, cl3}; -Point(6) = {-0.5, -0.25, 0, cl3}; -Point(7) = {0.5, -0.25, 0, cl3}; -Point(8) = {0, 0.6-Dy, 0, cl2}; -Circle(1) = {3, 8, 1}; -Circle(2) = {1, 8, 2}; -Line(3) = {2, 8}; -Line(13) = {8, 3}; -Line(4) = {6, 7}; -Line(5) = {7, 4}; -Line(6) = {4, 5}; -Line(7) = {5, 6}; -Line Loop(9) = {2, 3, 13, 1}; -Plane Surface(9) = {9}; -Line Loop(11) = {6, 7, 4, 5}; -Plane Surface(11) = {11}; -Physical Line("rigid") = {6}; -Physical Line("contact_surface") = {1, 2}; -Physical Line("top") = {3, 13}; -Physical Surface("top_body") = {9}; -Physical Surface("bottom_body") = {11}; diff --git a/extra_packages/contact_alejandro/examples/contact/hertz_3D.cc b/extra_packages/contact_alejandro/examples/contact/hertz_3D.cc deleted file mode 100644 index e71566fd5..000000000 --- a/extra_packages/contact_alejandro/examples/contact/hertz_3D.cc +++ /dev/null @@ -1,185 +0,0 @@ -/** - * @file hertz_3D.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Oct 19 2014 - * - * @brief File used to obtain 3D implicit contact results and compare with - * Hertz theory - * - * @section LICENSE - * - * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory - * (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include - -#include "contact_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - // type definitions - typedef Point point_type; - typedef BoundingBox bbox_type; - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - typedef std::chrono::high_resolution_clock clock; - typedef std::chrono::seconds seconds; - - clock::time_point t0 = clock::now(); - - initialize("steel.dat", argc, argv); - - // create mesh - Mesh mesh(dim); - - // read mesh - mesh.read("hertz_3D.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // optimal value of penalty multiplier - cd[Alpha] = 0.05; - cd[Multiplier_tol] = 1.e-2; - cd[Newton_tol] = 1.e-2; - cd[Verbose] = true; - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // call update current position to be able to call later - // the function to get current positions - model.updateCurrentPosition(); - - // get physical names from Gmsh file - mesh.createGroupsFromMeshData("physical_names"); - - // set-up bounding box to include slave nodes that lie inside it - Real l1 = 1.; - Real l2 = 0.2; - Real l3 = 1.; - point_type c1(-l1 / 2, -l2 / 2, -l3 / 2); - point_type c2(l1 / 2, l2 / 2, l3 / 2); - bbox_type bb(c1, c2); - - // get areas for the nodes of the circle - // this is done by applying a unit pressure to the contact surface elements - model.applyBC(BC::Neumann::FromHigherDim(Matrix::eye(3, 1.)), - "contact_surface"); - Array &areas = model.getForce(); - - // loop over contact surface nodes and store node areas - ElementGroup &eg = mesh.getElementGroup("contact_surface"); - Array &coords = mesh.getNodes(); - - cout << "- Adding areas to slave nodes. " << endl; - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - - point_type p(&coords(*nit)); - - // ignore slave node if it doesn't lie within the bounding box - if (!(bb & p)) - continue; - - cd.addSlave(*nit); - - // compute area contributing to the slave node - Real a = 0.; - for (UInt i = 0; i < dim; ++i) - a += pow(areas(*nit, i), 2.); - cd.addArea(*nit, sqrt(a)); - } - - // set force value to zero - areas.clear(); - - // add master surface to find pairs - cd.searchSurface("rigid_surface"); - - // apply boundary conditions for the rigid plane - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "bottom_body"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "bottom_body"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "bottom_body"); - - // block z-disp in extreme points of top surface - model.getBlockedDOFs()(1, 2) = true; - model.getBlockedDOFs()(2, 2) = true; - - // block x-disp in extreme points of top surface - model.getBlockedDOFs()(3, 0) = true; - model.getBlockedDOFs()(4, 0) = true; - - const size_t steps = 30; - Real data[3][steps]; // store results for printing - Real step = 0.001; // top displacement increment - size_t k = 0; - - for (Real delta = 0; delta <= step * steps; delta += step) { - // apply displacement to the top surface of the half-sphere - model.applyBC(BC::Dirichlet::FixedValue(-delta, _y), "top_surface"); - - // solve contact step, this function also dumps Paraview files - solveContactStep<_uzawa>(cd); - // solveContactStep<_generalized_newton>(cd); - - data[0][k] = delta; - data[1][k] = cd.getForce(); - data[2][k] = cd.getMaxPressure(); - ++k; - } - - // print results - size_t w = 14; - cout << setprecision(4); - cout << endl << setw(w) << "Disp." << setw(w) << "Force" << setw(w) - << "Max pressure" << endl; - for (size_t i = 0; i < steps; ++i) - cout << setw(w) << data[0][i] << setw(w) << data[1][i] << setw(w) - << data[2][i] << endl; - - clock::time_point t1 = clock::now(); - seconds total_s = std::chrono::duration_cast(t1 - t0); - cout << "*** INFO *** Simulation took " << total_s.count() << " s" << endl; - - // finalize simulation - finalize(); - return EXIT_SUCCESS; -} diff --git a/extra_packages/contact_alejandro/examples/contact/hertz_3D.geo b/extra_packages/contact_alejandro/examples/contact/hertz_3D.geo deleted file mode 100644 index c9a78db78..000000000 --- a/extra_packages/contact_alejandro/examples/contact/hertz_3D.geo +++ /dev/null @@ -1,54 +0,0 @@ -cl1 = 0.005; -cl2 = 0.1; -cl3 = 0.4; -Dy = 0.099; -Dz = 1; -Point(1) = {0, 0.1-Dy, 0, cl1}; -Point(2) = {0.5, 0.6-Dy, 0, cl2}; -Point(3) = {-0.5, 0.6-Dy, 0, cl2}; -Point(4) = {0, 0.6-Dy, 0, cl2}; -Point(5) = {0, 0.6-Dy, -0.5, cl2}; -Point(6) = {0, 0.6-Dy, 0.5, cl2}; - -Point(7) = {0, 0, 0, cl3}; -Point(8) = {0.5, 0, 0, cl3}; -Point(9) = {-0.5, 0, 0, cl3}; -Point(10) = {0, 0, -0.5, cl3}; -Point(11) = {0, 0, 0.5, cl3}; - -Circle(1) = {3, 4, 1}; -Circle(2) = {1, 4, 2}; -Circle(3) = {6, 4, 1}; -Circle(4) = {1, 4, 5}; -Circle(5) = {3, 4, 6}; -Circle(6) = {6, 4, 2}; -Circle(7) = {2, 4, 5}; -Circle(8) = {5, 4, 3}; -Line Loop(1) = {3, 2, -6}; -Ruled Surface(1) = {1}; -Line Loop(2) = {-2, -7, 4}; -Ruled Surface(2) = {2}; -Line Loop(3) = {-4, -8, -1}; -Ruled Surface(3) = {3}; -Line Loop(4) = {1, -3, -5}; -Ruled Surface(4) = {4}; -Line Loop(5) = {6, 7, 8, 5}; -Plane Surface(5) = {5}; -Surface Loop(1) = {3, 2, 1, 4, 5}; -Volume(1) = {1}; - -Circle(9) = {9, 7, 11}; -Circle(10) = {11, 7, 8}; -Circle(11) = {8, 7, 10}; -Circle(12) = {10, 7, 9}; -Line Loop(6) = {10, 11, 12, 9}; -Plane Surface(6) = {6}; -Extrude {0, -cl3, 0} { - Surface{6}; -} - -Physical Surface("top_surface") = {5}; -Physical Surface("rigid_surface") = {6}; -Physical Volume("top_body") = {1}; -Physical Volume("bottom_body") = {2}; -Physical Surface("contact_surface") = {1, 2, 4, 3}; diff --git a/extra_packages/contact_alejandro/examples/contact/steel.dat b/extra_packages/contact_alejandro/examples/contact/steel.dat deleted file mode 100644 index fae183ada..000000000 --- a/extra_packages/contact_alejandro/examples/contact/steel.dat +++ /dev/null @@ -1,7 +0,0 @@ -material neohookean [ - name = steel - rho = 7500 # kg/m^3 - E = 2e11 # GPa - nu = 0. - finite_deformation = 1 -] diff --git a/extra_packages/contact_alejandro/examples/contact/tetrahedra.cc b/extra_packages/contact_alejandro/examples/contact/tetrahedra.cc deleted file mode 100644 index 7707216ac..000000000 --- a/extra_packages/contact_alejandro/examples/contact/tetrahedra.cc +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file tetrahedra.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Oct 19 2014 - * - * @brief File used to obtain contact results for a simple tetrahedra test - * - * @section LICENSE - * - * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory - * (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -//#include "implicit_contact_manager.hh" - -using namespace akantu; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - typedef SolidMechanicsModel model_type; -// typedef ContactData contact_type; - typedef Contact > - contact_type; - - - // initialize akantu - initialize("steel.dat", argc, argv); - - // create and read mesh - Mesh mesh(dim); - mesh.read("tetrahedra.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize model - model.initFull(opt); - - // paraview output - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // create conctact object - contact_type cd(argc, argv, model); - - // add slave node of the tip of the top tetrahedron - cd.addSlave(4); - - // parameters - cd[Verbose] = true; - - // add search surface - cd.searchSurface("master"); - - // apply boundary conditions - mesh.createGroupsFromMeshData("physical_names"); - - using BC::Dirichlet::FixedValue; -// model.applyBC(FixedValue(0., _y), "top_surface"); - model.applyBC(FixedValue(0., _x), "top_surface"); - model.applyBC(FixedValue(0., _z), "top_surface"); - model.applyBC(FixedValue(0., _x), "bottom_surface"); - model.applyBC(FixedValue(0., _y), "bottom_surface"); - model.applyBC(FixedValue(0., _z), "bottom_surface"); - -// model.applyBC(FixedValue(0., _x), "master"); -// model.applyBC(FixedValue(0., _y), "master"); -// model.applyBC(FixedValue(0., _z), "master"); - - Real U = 2; - Real Du = 0.01; - - for (Real u = Du; u<=U; u += Du) { - -// model.applyBC(FixedValue(u, _x), "top_surface"); - model.applyBC(FixedValue(-u, _y), "top_surface"); - - // solve contact step (no need to call solve on the model object) -// solveContactStep<_uzawa>(cd); - solveContactStep<_generalized_newton>(cd); - } - - - // finalize simulation - finalize(); - return EXIT_SUCCESS; -} diff --git a/extra_packages/contact_alejandro/examples/contact/tetrahedra.geo b/extra_packages/contact_alejandro/examples/contact/tetrahedra.geo deleted file mode 100644 index 13859bf02..000000000 --- a/extra_packages/contact_alejandro/examples/contact/tetrahedra.geo +++ /dev/null @@ -1,69 +0,0 @@ -cl1 = 4; -off = 0.; -Point(1) = {-0.5, -0.5, -0.5, cl1}; -Point(2) = {-0.5, 0.5, -0.5, cl1}; -Point(3) = {0.5, 0.5, -0.5, cl1}; -Point(4) = {0.5, -0.5, -0.5, cl1}; -Point(5) = {0.25, 1.2, 0 + off, cl1}; -Point(6) = {0.75, 1.9, -0.5 + off, cl1}; -Point(7) = {-0.25, 1.9, -0.5 + off, cl1}; -Point(11) = {-0.5, -0.5, 0.5, cl1}; -Point(12) = {-0.5, 0.5, 0.5, cl1}; -Point(13) = {0.5, 0.5, 0.5, cl1}; -Point(14) = {0.5, -0.5, 0.5, cl1}; -Point(26) = {0.75, 1.9, 0.5 + off, cl1}; -Point(27) = {-0.25, 1.9, 0.5 + off, cl1}; -Line(1) = {1, 4}; -Line(2) = {4, 3}; -Line(3) = {3, 2}; -Line(4) = {2, 1}; -Line(5) = {5, 6}; -Line(6) = {6, 7}; -Line(7) = {7, 5}; -Line(11) = {11, 14}; -Line(12) = {14, 13}; -Line(13) = {13, 12}; -Line(14) = {12, 11}; -Line(15) = {14, 4}; -Line(16) = {13, 3}; -Line(17) = {11, 1}; -Line(18) = {12, 2}; -Line(19) = {27, 26}; -Line(20) = {26, 26}; -Line(21) = {26, 6}; -Line(22) = {27, 7}; -Line(23) = {26, 5}; -Line(24) = {27, 5}; -Line Loop(26) = {12, 16, -2, -15}; -Plane Surface(26) = {26}; -Line Loop(28) = {1, 2, 3, 4}; -Plane Surface(28) = {28}; -Line Loop(30) = {17, -4, -18, 14}; -Plane Surface(30) = {30}; -Line Loop(32) = {11, 12, 13, 14}; -Plane Surface(32) = {32}; -Line Loop(34) = {15, -1, -17, 11}; -Plane Surface(34) = {34}; -Line Loop(36) = {16, 3, -18, -13}; -Plane Surface(36) = {36}; -Line Loop(38) = {5, -21, 23}; -Plane Surface(38) = {38}; -Line Loop(40) = {24, -23, -19}; -Plane Surface(40) = {40}; -Line Loop(42) = {24, -7, -22}; -Plane Surface(42) = {42}; -Line Loop(44) = {5, 6, 7}; -Plane Surface(44) = {44}; -Line Loop(46) = {21, 6, -22, 19}; -Plane Surface(46) = {46}; -Surface Loop(48) = {38, 44, 46, 42, 40}; -Volume(48) = {48}; -Surface Loop(50) = {36, 26, 32, 34, 28, 30}; -Volume(50) = {50}; -Physical Surface("top_surface") = {46}; -Physical Surface("bottom_surface") = {34}; -Physical Surface("bottom_dummy") = {30, 32, 26, 28}; -Physical Surface("top_dummy") = {40, 38, 44, 42}; -Physical Surface("master") = {36}; -Physical Volume("top_body") = {48}; -Physical Volume("bottom_body") = {50}; diff --git a/extra_packages/contact_alejandro/examples/optimization/CMakeLists.txt b/extra_packages/contact_alejandro/examples/optimization/CMakeLists.txt deleted file mode 100644 index 5afced9b0..000000000 --- a/extra_packages/contact_alejandro/examples/optimization/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Alejandro M. Aragón -# -# @date creation: Sun Oct 19 2014 -# -# @brief configuration file for contact examples -# -# @section LICENSE -# -# Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory -# (LSMS - Laboratoire de Simulation en Mécanique des Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -# @section DESCRIPTION -# -#=============================================================================== - -register_example(fn_optimize fn_optimize.cc) diff --git a/extra_packages/contact_alejandro/examples/optimization/fn_optimize.cc b/extra_packages/contact_alejandro/examples/optimization/fn_optimize.cc deleted file mode 100644 index aaa64565f..000000000 --- a/extra_packages/contact_alejandro/examples/optimization/fn_optimize.cc +++ /dev/null @@ -1,101 +0,0 @@ -/** - * @file fn_optimize.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Oct 19 2014 - * - * @brief File used to show how to use the NLopt optimizator to find the - * minimum of a function - * - * @section LICENSE - * - * Copyright (©) 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) Laboratory - * (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include -#include - -#include "aka_optimize.hh" - - -typedef struct { - double a, b; -} my_constraint_data; - - -//! Functor used for the evaluation of the function and its gradient -class Functor { - - int count_; //!< Function evaluation counter - -public: - - //! Default constructor - Functor() : count_() {} - - //! Return function evaluation counter - int count() const - { return count_; } - - double operator()(const std::vector &x, std::vector &grad) - { - ++count_; - if (!grad.empty()) { - grad[0] = 0.0; - grad[1] = 0.5 / sqrt(x[1]); - } - return sqrt(x[1]); - } - - static double wrap(const std::vector &x, std::vector &grad, void *data) { - return (*reinterpret_cast(data))(x, grad); } - -}; - - -double myvconstraint(const std::vector &x, std::vector &grad, void *data) -{ - my_constraint_data *d = reinterpret_cast(data); - double a = d->a, b = d->b; - if (!grad.empty()) { - grad[0] = 3 * a * (a*x[0] + b) * (a*x[0] + b); - grad[1] = -1.0; - } - return ((a*x[0] + b) * (a*x[0] + b) * (a*x[0] + b) - x[1]); -} - - -int main(int argc, char *argv[]) { - - my_constraint_data data[2] = { {2,0}, {-1,1} }; - - std::vector x(2); - x[0] = 1.234; x[1] = 5.678; - - Functor fn; - akantu::Optimizator ofn(x, fn); - - ofn.add_inequality_constraint(myvconstraint, &data[0], 1e-8); - ofn.add_inequality_constraint(myvconstraint, &data[1], 1e-8); - - ofn.result(); - std::cout<<"\nTotal function evaluations: "<^ 2 - \frac{1}{2 \epsilon_N} \lambda^2_N \right] \, d\Gamma, -\end{equation} -where $ \Pi^{\left( i \right) } $ corresponds to the energy functional of the $ i $-th body in contact, which is a function of the displacement field $\boldsymbol u$ and the Lagrangian multiplier $\lambda_N$. In the equation above, $\epsilon_N$ is a penalty parameter, $g$ the contact gap function, and $\left< \cdot \right>$ the Macaulay bracket. - -The solution procedure seeks to make the equation above stationary with respect to both $\boldsymbol u$ and $\lambda_N$: -\begin{equation} -\begin{aligned} - 0 &= D_{\boldsymbol u} \Pi^{al} \cdot \boldsymbol w = G^{int,ext} \left( \boldsymbol u, \boldsymbol w \right) + \int_{\Gamma_c^{\left( 1 \right) } } \left< \lambda_N + \epsilon_N g \right> \delta g \, d\Gamma \qquad \forall \boldsymbol w \in \mathcal{V} \\ -0 &= D_{ \lambda} \Pi^{al} \cdot q_N = \frac{1}{\epsilon_N} \int_{\Gamma_c^{\left( 1 \right) } } \left[ \left< \lambda_N + \epsilon_N g \right> - \lambda_N \right] q_N \, d\Gamma \qquad \forall q_N \in \mathcal{M} -\end{aligned} -\end{equation} - -A solution is then found by using Uzawa's method, for which we solve for $ \boldsymbol u ^ {\left( k \right) }$, with $ \lambda_N^{\left( k \right)}$ fixed: -\begin{equation} - G^{int,ext} ( \boldsymbol u ^ {\left( k \right) }, \boldsymbol w ) + \int_{\Gamma_c^{\left( 1 \right) } } \left< \lambda_N^ {\left( k \right) } + \epsilon_N g( \boldsymbol u ^ {\left( k \right) } ) \right> \delta g \, d\Gamma = 0 \qquad \forall \boldsymbol w \in \mathcal{V}, - \end{equation} - -followed by an update of the multipliers on $\Gamma_c ^ {\left( 1 \right) }$: -\begin{equation} -\lambda _N ^ {\left( k+1 \right) } = \left< \lambda_N ^ {\left( k \right) } + \epsilon_N g ( \boldsymbol u ^ {\left( k \right) } ) \right>. -\end{equation} - - -It is worth noting that the results of the implicit contact resolution depend largely on the choice of the penalty parameter $ \epsilon_N $. Depending on this parameter, the computational time needed to obtain a converged solution can be increased dramatically, or a convergence solution could not even be obtained at all. - -The code provides a flag that allows the user to rely on an automatic value of $ \epsilon_N $ for each slave node. Yet, this value should be used as a reference only, since for some problems it is actually overestimated and convergence cannot be obtained. - - -\subsection{Implementation} - -In \akantu, the object that handles the implicit contact can be found in \code{implicit\_contact\_manager.hh}. -The object that handles the implicit contact resolution stage is the class template -\begin{cpp} -template struct ContactData; -\end{cpp} -This object takes the command line parameters during construction, which can be used to set up the behavior during contact resolution. The object can take the following parameters (default values in brackets): - -\begin{tabular}{lrl} - -e & [auto] & Penalty parameter for augmented-Lagrangian formulation \\ - -alpha & [1] & Multiplier for values of the penalty parameter\\ - -utol & [0.001] & Tolerance used for multipliers in the Uzawa method\\ - -ntol &[0.001]& Tolerance used in the Newton-Raphson inner convergence loop\\ - -usteps &[100]& Maximum number of steps allowed in the Uzawa loop\\ - -nsteps & [100]& Maximum number of steps allowed in the Newton-Raphson loop\\ -\end{tabular} \\ - - -Also, the following flags can be given to the command line - - -\begin{tabular}{ll} - -dump& Dumping within Newton iterations \\ - -v& Verbose output -\end{tabular} \\ - - - -The \code{ContactData} object stores the state of the contact mechanics simulation. The state is contained within the following variables: - -\begin{tabular}{ll} - \code{sm\_} & slave-master map \\ - \code{multipliers\_} & Lagrange multiplier map \\ - \code{areas\_} & slave areas map \\ - \code{penalty\_} & penalty parameter map \\ - \code{gaps\_} & gap function map \\ - \code{model\_} & reference to solid mechanics model \\ - \code{multiplier\_dumper\_} & structures used to dump multipliers \\ - \code{pressure\_dumper\_} & structures used to dump pressure \\ - \code{options\_} & options map \\ - \code{flags\_} & flags map \\ - \code{uiter\_}, \code{niter\_} & Uzawa and Newton iteration counters -\end{tabular} \\ - - -The interface of the \code{ContactData} object contains three methods to solve for each contact step, which is overloaded depending on the parameters passed. Their signatures are as follows - - -\begin{cpp} -void solveContactStep(); - -void solveContactStep(search_type *search); - -template -void solveContactStep(search_type *search, const PostAssemblyFunctor& fn); -} -\end{cpp} - -The second method allows the user to provide a pointer to an object that is used to search slave-master pairs. This can be done, for example, when due to the deformed configuration current slave-master pairs are no longer valid. -The last method in the snippet above allows the user to provide a functor that is called after the assembly of the contact contributions to the stiffness matrix and the force vector. The last takes place within the method \code{computeTangentAndResidual()}. - - -\subsubsection{Hertz Example} - - -Here we outline, step by step, the use of the implicit contact solver to obtain the solution of Hertzian contact. The complete implementation can be found in \code{examples/contact/hertz\_3D.cc}. - -The following class is used as the object that will perform the search for new contact elements when a slave node is found to lie outside its master element. The class derives from a \code{SearchBase} class, and implements the virtual method \code{search}. - -\begin{cpp} -struct Assignator : public ContactData<3,SolidMechanicsModel>::SearchBase { - typedef Point <3> point_type; - typedef SolidMechanicsModel model_type; - typedef ModelElement master_type; - - model_type &model_; - - Assignator(model_type& model) : model_(model) {} - - virtual int search(const Real *ptr) { - point_type p(ptr); - - ElementGroup &rs = model_.getMesh().getElementGroup("rigid_surface"); - - for (ElementGroup::type_iterator tit = rs.firstType(); tit != rs.lastType(); ++tit) - for (ElementGroup::const_element_iterator it = rs.element_begin(*tit); - it != rs.element_end(*tit); ++it) { - master_type m(model_, _triangle_3, *it); - if (point_has_projection_to_triangle(p, m.point <3>(0), m.point <3>(1), m.point <3>(2))) { - return m.element; - } - } - return -1; - } -}; -\end{cpp} - - -The first thing we do in the main file is to add some type definitions: - -\begin{cpp} - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - // type definitions - typedef Point point_type; - typedef BoundingBox bbox_type; - typedef SolidMechanicsModel model_type; - typedef ModelElement master_type; - typedef ContactData contact_type; - - typedef std::chrono::high_resolution_clock clock; - typedef std::chrono::seconds seconds; -\end{cpp} - -We initialize the library, create a mesh, and set the solid mechanics model up: - -\begin{cpp} - - initialize("steel.dat", argc, argv); - - // create mesh - Mesh mesh(dim); - - // read mesh - mesh.read("hertz_3D.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); -\end{cpp} - - -Then we create the contact data, which can be used to solve the contact problem. Note that some of the parameters required by the contact object can be coded in the implementation file (these can also be passed as arguments). -\begin{cpp} - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // optimal value of penalty multiplier - cd[Alpha] = 0.05; - cd[Uzawa_tol] = 1.e-2; - cd[Newton_tol] = 1.e-2; -\end{cpp} - - -Next we find the area that corresponds to each slave node. For this we use the fact that if we apply a unit distributed load over the contact surface, the resulting force vector at each slave node has magnitude that is equal to the area. -\begin{cpp} - - // get physical names from Gmsh file - mesh.createGroupsFromMeshData ("physical_names"); - - // get areas for the nodes of the circle - // this is done by applying a unit pressure to the contact surface elements - model.applyBC(BC::Neumann::FromHigherDim(Matrix ::eye(3, 1.)), "contact_surface"); - Array & areas = model.getForce(); - - // loop over contact surface nodes and store node areas - ElementGroup &eg = mesh.getElementGroup("contact_surface"); - cout << "- Adding areas to slave nodes. " << endl; - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - // compute area contributing to the slave node - Real a = 0.; - for (UInt i = 0; i < dim; ++i) - a += pow(areas(*nit, i), 2.); - cd.addArea(*nit, sqrt(a)); - } - - // set force value to zero - areas.clear(); -\end{cpp} - -Note that we clear the force vector after the assignment of areas. - -In the next step we prescribe the boundary conditions that do not change in time: - -\begin{cpp} - - // apply boundary conditions for the rigid plane - model.applyBC(BC::Dirichlet::FixedValue(0., BC::_x), "bottom_body"); - model.applyBC(BC::Dirichlet::FixedValue(0., BC::_y), "bottom_body"); - model.applyBC(BC::Dirichlet::FixedValue(0., BC::_z), "bottom_body"); - - // block z-disp in extreme points of top surface - model.getBoundary()(1, 2) = true; - model.getBoundary()(2, 2) = true; - - // block x-disp in extreme points of top surface - model.getBoundary()(3, 0) = true; - model.getBoundary()(4, 0) = true; - -\end{cpp} - - -Next we add the slave-master pairs for the analysis. We use a bounding box to consider only a fraction of the slave nodes in the model. Those slave nodes that are not within the bounding box are not considered in the analysis: -\begin{cpp} - - // set-up bounding box to include slave nodes that lie inside it - Real l1 = 1.; - Real l2 = 0.2; - Real l3 = 1.; - point_type c1(-l1 / 2, -l2 / 2, -l3 / 2); - point_type c2(l1 / 2, l2 / 2, l3 / 2); - bbox_type bb(c1, c2); - - // search policy for slave-master pairs - Assignator a(model); - - - // loop over nodes in contact surface to create contact elements - cout << "- Adding slave-master pairs" << endl; - for (auto nit = cs.node_begin(); nit != cs.node_end(); ++nit) { - point_type p(&coords(*nit)); - - // ignore slave node if it doesn't lie within the bounding box - if (!(bb & p)) - continue; - - int el = a.search(&coords(*nit)); - if (el != -1) - cd.addPair(*nit, master_type(model, _triangle_3, el)); - } -\end{cpp} - - -We then start the loop over displacement increments, and at each step we call {{{solveContactStep}}} and save the displacement, resulting force, and maximum pressure, in an array that will be used to print the results at the end of the simulation: -\begin{cpp} - - const size_t steps = 30; - Real data[3][steps]; // store results for printing - Real step = 0.001; // top displacement increment - size_t k = 0; - - for (Real delta = 0; delta <= step * steps; delta += step) { - // apply displacement to the top surface of the half-sphere - model.applyBC(BC::Dirichlet::FixedValue(-delta, BC::_y), "top_surface"); - - // solve contact step, this method also dumps Paraview files - cd.solveContactStep(&a); - - data[0][k] = delta; - data[1][k] = cd.getForce(); - data[2][k] = cd.getMaxPressure(); - ++k; - } -\end{cpp} - - -The last portion of the output of code above is as follows: -\begin{verbatim} - Disp. Force Max pressure - 0 0 0 - 0.001 1.29 6.068e+04 - 0.002 6.702e+06 6.78e+09 - 0.003 1.832e+07 9.453e+09 - 0.004 3.349e+07 1.091e+10 - 0.005 5.2e+07 1.171e+10 - 0.006 7.211e+07 1.298e+10 - 0.007 9.377e+07 1.481e+10 - 0.008 1.183e+08 1.624e+10 - 0.009 1.41e+08 1.616e+10 - 0.01 1.7e+08 1.688e+10 - 0.011 1.963e+08 1.678e+10 - 0.012 2.263e+08 1.758e+10 - 0.013 2.581e+08 1.805e+10 - 0.014 2.907e+08 1.821e+10 - 0.015 3.244e+08 1.877e+10 - 0.016 3.593e+08 1.954e+10 - 0.017 4.051e+08 2.131e+10 - 0.018 4.317e+08 2.115e+10 - 0.019 4.823e+08 2.201e+10 - 0.02 5.237e+08 2.315e+10 - 0.021 5.639e+08 2.379e+10 - 0.022 6.058e+08 2.405e+10 - 0.023 6.483e+08 2.485e+10 - 0.024 6.917e+08 2.536e+10 - 0.025 7.363e+08 2.854e+10 - 0.026 7.681e+08 3.099e+10 - 0.027 8.332e+08 3.291e+10 - 0.028 8.577e+08 3.399e+10 - 0.029 9.281e+08 3.426e+10 -\end{verbatim} - -The following figure shows the deformed state of the half-sphere at the end of the simulation, together with the contact pressure distribution: - -\begin{figure}[htbp] -\begin{center} -\includegraphics[scale=0.3]{figures/hertz_3D.png} -\caption{State of pressure and deformation at the end of the simulation of the example of Hertz in 3D.} -\label{fig:hertz_3D} -\end{center} -\end{figure} diff --git a/extra_packages/contact_alejandro/package.cmake b/extra_packages/contact_alejandro/package.cmake deleted file mode 100644 index b1e1d4e10..000000000 --- a/extra_packages/contact_alejandro/package.cmake +++ /dev/null @@ -1,9 +0,0 @@ -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/packages") - -include(contact) -include(cpparray) -include(nlopt) -include(optimization) - -#add_example(contact "Examples on how to use contact within Akantu" PACKAGE contact) -#add_example(optimization "Optimization examples" PACKAGE optimization) diff --git a/extra_packages/contact_alejandro/packages/contact.cmake b/extra_packages/contact_alejandro/packages/contact.cmake deleted file mode 100644 index 5f584dc51..000000000 --- a/extra_packages/contact_alejandro/packages/contact.cmake +++ /dev/null @@ -1,98 +0,0 @@ -#=============================================================================== -# @file contact.cmake -# -# @author Alejandro M. Aragón -# @author Nicolas Richart -# -# @date creation: Mon Nov 21 2011 -# @date last modification: Mon Jan 18 2016 -# -# @brief package description for contact -# -# @section LICENSE -# -# Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de -# Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des -# Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -#=============================================================================== - -package_declare(contact - DESCRIPTION "Use Contact package of Akantu" - DEPENDS cpparray implicit optimization core_cxx11) - - -package_declare_sources(contact - common/aka_point.hh - common/aka_ball.cc - common/aka_plane.hh - common/aka_polytope.hh - common/aka_ball.hh - common/aka_timer.hh - common/aka_tree.hh - common/aka_bounding_box.hh - common/aka_bounding_box.cc - common/aka_geometry.hh - common/aka_geometry.cc - model/solid_mechanics/solid_mechanics_model_element.hh - - #cc files - contact/discretization.cc - contact/element.cc - contact/friction.cc - contact/resolution/resolution_augmented_lagrangian.cc - contact/scheme.cc - contact/search.cc - contact/surface.cc - contact/zone.cc - contact/contact_impl.cc - - # include files - contact/contact_common.hh - contact/contact_manager.hh - contact/discretization.hh - contact/element.hh - contact/friction.hh - contact/resolution.hh - contact/resolution/resolution_augmented_lagrangian.hh - contact/scheme.hh - contact/search.hh - contact/surface.hh - contact/zone.hh - contact/contact_impl.hh - ) - - -if(AKANTU_CONTACT) - list(APPEND AKANTU_BOOST_COMPONENTS - chrono - system - ) -endif() - -package_declare_documentation_files(contact - manual-contact.tex - figures/hertz_3D.png - ) - -package_declare_documentation(contact - "This package enables the contact mechanics engine for Akantu" - ) - -package_set_package_system_dependency(contact deb-src - libboost-system-dev libboost-chrono-dev) -package_set_package_system_dependency(contact deb - libboost-system1.58 libboost-chrono1.58) diff --git a/extra_packages/contact_alejandro/packages/cpparray.cmake b/extra_packages/contact_alejandro/packages/cpparray.cmake deleted file mode 100644 index 6ca42f43f..000000000 --- a/extra_packages/contact_alejandro/packages/cpparray.cmake +++ /dev/null @@ -1,70 +0,0 @@ -#=============================================================================== -# @file cpparray.cmake -# -# @author Guillaume Anciaux -# @author Alejandro M. Aragón -# @author Nicolas Richart -# -# @date creation: Fri Mar 15 2013 -# @date last modification: Mon Jan 18 2016 -# -# @brief package description for cpp_array project -# -# @section LICENSE -# -# Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) -# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -#=============================================================================== - -package_declare(CppArray EXTERNAL - DESCRIPTION "Use cpp-array library" - SYSTEM OFF) - -package_use_system(CppArray _use_system) -package_get_option_name(CppArray _option_name) - -if(NOT ${_use_system}) - if(${_option_name}) - if(TARGET cpparray) - return() - endif() - - set(CPPARRAY_DIR ${PROJECT_BINARY_DIR}/third-party) - - include(ExternalProject) - ExternalProject_Add(cpparray - PREFIX ${CPPARRAY_DIR} - GIT_REPOSITORY https://code.google.com/p/cpp-array.git - CMAKE_ARGS /cpp-array - CMAKE_CACHE_ARGS -DCMAKE_INSTALL_PREFIX:PATH= -Dcpp-array_TESTS:BOOL=OFF -DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} -DCMAKE_CXX_COMPILER:PATH=${CMAKE_CXX_COMPILER} -DCMAKE_Fortran_COMPILER:PATH=${CMAKE_Fortran_COMPILER} - ) - - set(CPPARRAY_INCLUDE_DIR ${CPPARRAY_DIR}/include CACHE PATH "" FORCE) - - package_set_include_dir(CppArray ${CPPARRAY_INCLUDE_DIR}) - package_add_extra_dependency(CppArray cpparray) - endif() -endif() - -package_declare_documentation(CppArray - "This package provides access to the \\href{https://code.google.com/p/cpp-array/}{cpp-array}" - "open-source project. If internet is accessible when configuring the project (during cmake call)" - "this package will be auto-downloaded." - ) - -package_declare_extra_files_to_package(CppArray - PROJECT cmake/Modules/FindCppArray.cmake) diff --git a/extra_packages/contact_alejandro/packages/nlopt.cmake b/extra_packages/contact_alejandro/packages/nlopt.cmake deleted file mode 100644 index bdd19e871..000000000 --- a/extra_packages/contact_alejandro/packages/nlopt.cmake +++ /dev/null @@ -1,88 +0,0 @@ -#=============================================================================== -# @file nlopt.cmake -# -# @author Guillaume Anciaux -# @author Alejandro M. Aragón -# @author Nicolas Richart -# -# @date creation: Thu Jun 05 2014 -# @date last modification: Mon Jan 18 2016 -# -# @brief package for the opitmization library NLopt -# -# @section LICENSE -# -# Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) -# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -#=============================================================================== - -package_declare(nlopt EXTERNAL - DESCRIPTION "Use NLOPT library" - SYSTEM OFF) - -package_use_system(nlopt _use_system) - -if(NOT ${_use_system}) - package_get_option_name(nlopt _option_name) - - if(${_option_name}) - set(NLOPT_VERSION "2.4.2") - set(NLOPT_ARCHIVE "${PROJECT_SOURCE_DIR}/third-party/nlopt-${NLOPT_VERSION}.tar.gz") - set(NLOPT_ARCHIVE_HASH "MD5=d0b8f139a4acf29b76dbae69ade8ac54") - if(NOT EXISTS ${NLOPT_ARCHIVE}) - set(NLOPT_ARCHIVE "http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz") - endif() - - string(TOUPPER "${CMAKE_BUILD_TYPE}" _u_build_type) - set(NLOPT_CONFIGURE_COMMAND CXX=${CMAKE_CXX_COMPILER} CXX_FLAGS=${CMAKE_CXX_FLAGS_${_u_build_type}} /configure - --prefix= --enable-shared --with-cxx --without-threadlocal - --without-guile --without-python --without-octave --without-matlab) - set(NLOPT_DIR ${PROJECT_BINARY_DIR}/third-party) - - include(ExternalProject) - - ExternalProject_Add(NLopt - PREFIX ${NLOPT_DIR} - URL ${NLOPT_ARCHIVE} - URL_HASH ${NLOPT_ARCHIVE_HASH} - CONFIGURE_COMMAND ${NLOPT_CONFIGURE_COMMAND} - BUILD_COMMAND make - INSTALL_COMMAND make install - ) - - set_third_party_shared_libirary_name(NLOPT_LIBRARIES nlopt_cxx) - set(NLOPT_INCLUDE_DIR ${NLOPT_DIR}/include CACHE PATH "Include directories for NLopt" FORCE) - mark_as_advanced(NLOPT_INCLUDE_DIR) - - package_set_libraries(nlopt ${NLOPT_LIBRARIES}) - package_set_include_dir(nlopt ${NLOPT_INCLUDE_DIR}) - - package_add_extra_dependency(nlopt NLopt) - endif() -else() - package_rm_extra_dependency(nlopt NLopt) -endif() - -package_declare_documentation(nlopt - "This package enable the use of the optimization alogorithm library \\href{http://ab-initio.mit.edu/wiki/index.php/NLopt}{NLopt}." - "Since there are no packaging for the common operating system by default \\akantu compiles it as a third-party project. This behavior can be modified with the option \\code{AKANTU\\_USE\\_THIRD\\_PARTY\\_NLOPT}." - "" - "If the automated download fails please download \\href{http://ab-initio.mit.edu/nlopt/nlopt-${NLOPT_VERSION}.tar.gz}{nlopt-${NLOPT_VERSION}.tar.gz} and place it in \\shellcode{/third-party} download." - ) - -package_declare_extra_files_to_package(nlopt - PROJECT cmake/Modules/FindNLopt.cmake) diff --git a/extra_packages/contact_alejandro/packages/optimization.cmake b/extra_packages/contact_alejandro/packages/optimization.cmake deleted file mode 100644 index db5d8fc7e..000000000 --- a/extra_packages/contact_alejandro/packages/optimization.cmake +++ /dev/null @@ -1,46 +0,0 @@ -#=============================================================================== -# @file optimization.cmake -# -# @author Nicolas Richart -# -# @date creation: Fri Jan 04 2013 -# @date last modification: Mon Mar 30 2015 -# -# @brief Optimization external library interface -# -# @section LICENSE -# -# Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) -# Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -#=============================================================================== - -package_declare(optimization - DESCRIPTION "Use optimization package in Akantu" - DEPENDS nlopt - ADVANCED) - - -package_declare_sources(optimization - common/aka_optimize.hh - common/aka_optimize.cc - ) - - -package_declare_documentation(optimization - "This activates the optimization routines of Akantu. This is currently needed by the" - "contact detection algorithms." - ) diff --git a/extra_packages/contact_alejandro/src/common/aka_ball.cc b/extra_packages/contact_alejandro/src/common/aka_ball.cc deleted file mode 100644 index 2e9993678..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_ball.cc +++ /dev/null @@ -1,74 +0,0 @@ -/** - * @file aka_ball.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Sep 26 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief bounding sphere classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#include "aka_ball.hh" - -__BEGIN_AKANTU__ - - -template <> -std::ostream& Interval::print(std::ostream& os) const { - os<<"Interval["< -std::ostream& Circle::print(std::ostream& os) const { - os<<"Disk["< -std::ostream& Sphere::print(std::ostream& os) const { - os<<"Sphere["< -typename Ball<1>::value_type Ball<1>::measure() const -{ return r_; } - -template <> -typename Ball<2>::value_type Ball<2>::measure() const -{ return pow(r_,2); } - -template <> -typename Ball<3>::value_type Ball<3>::measure() const -{ return pow(r_,3); } - - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/common/aka_ball.hh b/extra_packages/contact_alejandro/src/common/aka_ball.hh deleted file mode 100644 index 794c5fc68..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_ball.hh +++ /dev/null @@ -1,286 +0,0 @@ -/** - * @file aka_ball.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief bounding ball classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_BALL_HH__ -#define __AKANTU_BALL_HH__ - -#include - -#include "aka_common.hh" -#include "aka_point.hh" -#include "aka_bounding_box.hh" - -__BEGIN_AKANTU__ - -static Real epsilon = 10*std::numeric_limits::epsilon(); - -using std::cout; -using std::endl; - - - -//! Ball class template -/*! This class template represents the abstraction of a d-dimensional sphere. - * \tparam d - Ball dimension - */ -template -class Ball : public Bounding_volume { - -public: - - - typedef Bounding_volume base_type; - typedef typename base_type::point_type point_type; - - typedef typename point_type::value_type value_type; - typedef BoundingBox aabb_type; - - //! Return ball dimension - constexpr static int dim() - { return d; } - - //! Parameter constructor takes the ball center point and its radius - Ball(const point_type& c = point_type(), value_type r = value_type()) : base_type(), c_(c), r_(r) {} - - //! Combine two ball objects - virtual base_type* combine(const base_type& b) const { - - const Ball* sp = dynamic_cast(&b); - assert(sp != nullptr); - const Ball& s0 = *sp; - Ball r(s0); - r += *this; - return new Ball(r); - } - - - //! Standard output stream operator - virtual std::ostream& print(std::ostream& os) const; - - aabb_type bounding_box() const { - point_type o = r_*point_type(1.); - return aabb_type(c_ - o, c_ + o); - } - - //! Get ball center - point_type const& center() const - { return c_; } - - //! Get ball radius - value_type const& radius() const - { return r_; } - - //! Use in generic code as comparative measure of how big the sphere is - value_type measure() const; - - //! Grow sphere if point lies outside of it - Ball& operator+=(const point_type& p) { - - point_type diff = p - c_; - value_type sq_norm = diff.sq_norm(); - - if (sq_norm > r_*r_) { - - value_type norm = sqrt(sq_norm); - value_type new_r = 0.5*(r_ + norm); - value_type scalar = (new_r - r_) / norm; - r_ = new_r; - c_ += scalar * diff; - } - return *this; - } - - //! Determine the ball that encloses both spheres - Ball& operator+=(const Ball s) { - - point_type diff = s.c_ - c_; - value_type sq_norm = diff.sq_norm(); - - // one ball is contained within the other - if (pow(s.r_ - r_, 2) >= sq_norm) { - if(s.r_ >= r_) - this->operator=(s); - // else do nothing, as the current ball is bigger - // and no further changes are required - } - // else balls partially overlapping or disjoint - else { - - // compute new radius - value_type norm = sqrt(sq_norm); - value_type tmp = r_; - r_ = 0.5 * (norm + r_ + s.r_); - if (norm > epsilon) - c_ += ((r_ - tmp) / norm) * diff; - } - return *this; - } - - - //! Check for collision with a point - bool operator&(const point_type& p) const - { return (p - c_).sq_norm() - r_*r_ < epsilon; } - - //! Check for collision with another ball - bool operator&(const Ball& s) const - { return (c_ - s.c_).sq_norm() - pow(r_ + s.r_,2.) < epsilon; } - - //! Compute ball from intersection of bounding boxes of two balls - Ball operator&&(const Ball& b) const { - - // get bounding boxes of spheres - aabb_type bb1 = bounding_box(); - aabb_type bb2 = b.bounding_box(); - - // compute intersection - aabb_type bbint = bb1 && bb2; - - // compute center and radius of the sphere - point_type c = 0.5*(bbint.min() + bbint.max()); - value_type r = sqrt((bbint.min() - bbint.max()).sq_norm()); - - // construct sphere - return Ball(c,r); - } - - - -private: - - point_type c_; //!< Ball center - Real r_; //!< Ball radius -}; - - -//! Interval type definition -typedef Ball<1> Interval; - -//! Circle type definition -typedef Ball<2> Circle; - -//! Sphere type definition -typedef Ball<3> Sphere; - - -//! Add two balls -template -Ball operator+(const Ball& s1, const Ball& s2) { - Ball r(s1); - return r += s2; -} - - - -//! Extreme points algirhtm by Ritter -/*! J. Ritter, Graphics gems, Academic Press Professional, Inc., San Diego, CA, USA, 1990, Ch. - * An efficient bounding sphere, pp. 301–303. URL http://dl.acm.org/citation.cfm?id=90767.90836 - */ -template -std::pair extreme_points(const point_container& pts) { - - typedef typename point_container::value_type point_type; - typedef typename point_type::value_type value_type; - - size_t min[] = { 0, 0, 0 }; - size_t max[] = { 0, 0, 0 }; - - // loop over container points to find extremal points - for (size_t i=1; i pts[max[j]][j]) - max[j] = i; - } - } - - // pick the pair of the longest distance - size_t m=0, M=0; - value_type sq_norm = value_type(); - - for (int i=0; i sq_norm) { - m = min[i]; - M = max[i]; - sq_norm = new_sq_norm; - } - } - - return std::make_pair(m,M); -} - -//! Create a bounding ball from a container of points -template -Ball bounding_ball(const point_container& pts) { - - assert(!pts.empty()); - - typedef typename point_container::value_type point_type; - typedef typename point_type::value_type value_type; - - // find extreme points on axis-aligned bounding box to construct - // first approximation of the sphere - std::pair mM = extreme_points(pts); - - // compute center and radius of the sphere - const point_type &m = pts[mM.first]; - const point_type &M = pts[mM.second]; - point_type c = 0.5*(m+M); - value_type r = sqrt((M-c).sq_norm()); - - // construct sphere - Ball s(c,r); - - // second pass: update the sphere so that all points lie inside - for (size_t i=0; i - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Tue Dec 08 2015 - * - * @brief Implementation of the bounding box class - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "aka_bounding_box.hh" -#include "aka_array.hh" - -__BEGIN_AKANTU__ - - -template <> -std::ostream& operator<< <1>(std::ostream& os, const BoundingBox<1>& bb) { - - os<<"Line["< -std::ostream& operator<< <2>(std::ostream& os, const BoundingBox<2>& bb) { - - os<<"Rectangle["< -std::ostream& operator<< <3>(std::ostream& os, const BoundingBox<3>& bb) { - - os<<"Cuboid["< -BoundingBox createPointList(const nodes_container& nodes, const Array& coord) { - - // AKANTU_DEBUG_ASSERT(nodes.getSize() != 0, "No nodes to create a bounding box with."); - typedef typename nodes_container::const_iterator node_iterator; - - node_iterator it = nodes.begin(); - assert(it != nodes.end()); - - BoundingBox bbox(Point(&coord(*it),coord.getNbComponent())); - for (++it; it != nodes.end(); ++it) { - //Real * point_coord = &coord(*it); - for (UInt d=0; d - * @author David Simon Kammer - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief class for a bounding box - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_AKA_BOUNDING_BOX_HH__ -#define __AKANTU_AKA_BOUNDING_BOX_HH__ - -#include -#include - -#include "aka_common.hh" -#include "aka_point.hh" - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - -template class BoundingBox; - -/// considers bounding box with respect to a list of points and adaptes it -template -BoundingBox computeBoundingBox(const point_container& points) { - - typedef typename point_container::const_iterator point_iterator; - point_iterator it = points.begin(); - assert(it != points.end()); - - BoundingBox bbox(*it); - for (++it; it != points.end(); ++it) - bbox += *it; - return bbox; -} - - -template -BoundingBox createPointList(const nodes_container& nodes, const Array& coord); - - -template -class BoundingBox : public Bounding_volume { - -public: - - typedef Bounding_volume base_type; - typedef typename base_type::point_type point_type; - typedef typename point_type::value_type value_type; - - static int dim() - { return d; } - -private: - - /// minimum point - point_type min_; - - /// maximum point - point_type max_; - -public: - - /// default constructor, creates an inconsistent bounding box - BoundingBox() : base_type(), min_(inf), max_(-inf) {} - - /// point constructor, sets the bounding box to the point - BoundingBox(const point_type& p1) : base_type(), min_(p1), max_(p1) {} - - /// two-point constructor, calculates minimum and maximum points - BoundingBox(const point_type& p1, const point_type& p2, bool compute = true) - : base_type(), min_(p1), max_(p2) - { - if (compute) - for (Int i=0; i - BoundingBox(iterator first, iterator last) : base_type(), min_(*first), max_(*first) { - ++first; - for (; first != last; ++first) - this->operator+=(*first); - } - - /// returns the measure of the bounding box: the measure is the volume of the box - value_type measure() const { - value_type v = 1; - for (int i=0; ioperator+=(bbox.min_); - this->operator+=(bbox.max_); - return *this; - } - - /// is the point p geometrically inside of the bounding box? - bool operator&(const point_type& p) const { - - Real e = 2*std::numeric_limits::epsilon(); - - for (Int i=0; i::epsilon(); - - for (Int i=0; i -BoundingBox operator+(const BoundingBox& b1, const BoundingBox& b2) { - BoundingBox r(b1); - return r += b2; -} - -template -std::ostream& operator<<(std::ostream&, const BoundingBox&); - - - -__END_AKANTU__ - -#endif /* __AKANTU_AKA_BOUNDING_BOX_HH__ */ diff --git a/extra_packages/contact_alejandro/src/common/aka_geometry.cc b/extra_packages/contact_alejandro/src/common/aka_geometry.cc deleted file mode 100644 index 0337f1d9f..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_geometry.cc +++ /dev/null @@ -1,57 +0,0 @@ -/** - * @file aka_geometry.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jun 18 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief geometric operations - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - - -#include "aka_geometry.hh" - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - -/*! \param p - A constant reference to the first point that defines the line segment. - * \param q - A constant reference to the second point that defines the line segment. - * \param r - A constant reference to the point for which the predicate is computed. - * \return A double, being -1.0 if the point lines on one side of the line and 1.0 if it lies - * on the other side. - */ -Real left_turn(const Point<2>& p, const Point<2>& q, const Point<2>& r) { - - if(((q[0]-p[0]) * (r[1]-p[1])) > ((r[0]-p[0]) * (q[1]-p[1]))) - return 1.; - else - return -1.; -} - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/common/aka_geometry.hh b/extra_packages/contact_alejandro/src/common/aka_geometry.hh deleted file mode 100644 index 9a6bb297c..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_geometry.hh +++ /dev/null @@ -1,365 +0,0 @@ -/** - * @file aka_geometry.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Wed Dec 16 2015 - * - * @brief geometric operations - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - - -#ifndef __AKANTU_GEOMETRY_HH__ -#define __AKANTU_GEOMETRY_HH__ - -#include -#include -#include "aka_point.hh" -#include "aka_plane.hh" -#include "aka_math.hh" - -__BEGIN_AKANTU__ - -// predicates - -// combined tolerance test, from Christer Ericson -template -typename std::enable_if::value, bool>::type -equal(T x, T y) -{ return x == y; } - - -Real left_turn(const Point<2>& p, const Point<2>& q, const Point<2>& r); - - - -// closest point computations - - -//! Computes the closest point laying on a segment to a point -/*! Given segment \c ab and point \c c, computes closest point \c d on ab. - * Also returns \c t for the position of the point: a + t*(b - a) - */ -template -Point closest_point_to_segment(const Point& c, - const Point& a, - const Point& b) { - - Point ab = b - a; - - - // project c onto ab, computing parameterized position d(t) = a + t*(b – a) - - T t = (c - a)*ab / sqrt(ab*ab); - - // if outside segment, clamp t (and therefore d) to the closest endpoint - if (t < 0.) - t = 0.; - else if (t > 1.) - t = 1.; - - // compute projected position from the clamped t - return a + t * ab; -} - -//! Predicate that checks if a point has a projection on a line segment -/*! Given segment \c ab and point \c c, checks if the point has a projection in the segment. - */ -template -bool has_projection(const Point& c, - const Point& a, - const Point& b) { - - Point ab = b - a; - // project c onto ab, computing parameterized position d(t) = a + t*(b – a) - - T t = (c - a)*ab / (ab*ab); - return t > 0. && t < 1.; -} - -//! Tests if a point has a projection to a triangle -/*! This function uses the concept of Voronoi regions to determine - * if a point has a projection within a triangle defined by points - * \c a, \c b, and \c c. - */ -template -bool point_has_projection_to_triangle(const Point<3,T>& p, - const Point<3,T>& a, - const Point<3,T>& b, - const Point<3,T>& c) { - - typedef Point<3,T> point_type; - - // obtain plane of the triangle - Plane pi(a,b,c); - - // get point in the plane closest to p - point_type q = closest_point_to_plane(p,pi); - - // return if point is within the triangle - if (is_point_in_triangle(q, a, b, c)) - return true; - return false; -} - -//! Tests if point P lies inside a triangle -/*! The triangle is defined by points \c a, \c b and \c c. - */ - -template -bool is_point_in_triangle(const Point<3,T>& p, - const Point<3,T>& a, - const Point<3,T>& b, - const Point<3,T>& c) { - - typedef Point<3,T> point_type; - - point_type v0 = b-a, v1 = c-a, v2 = p-a; - - Real d00 = v0*v0; - Real d01 = v0*v1; - Real d11 = v1*v1; - Real d20 = v2*v0; - Real d21 = v2*v1; - Real denom = d00*d11 - d01*d01; - - // compute parametric coordinates - Real v = (d11 * d20 - d01 * d21) / denom; - Real w = (d00 * d21 - d01 * d20) / denom; - return v >= 0. && w >= 0. && v + w <= 1.; -} - - - -//! Compute the closest point to a triangle -/*! This function uses the concept of Voronoi regions to determine - * the closest point \c p to a triangle defined by points \c a, \c b - * \c c. - */ -template -Point<3,T> closest_point_to_triangle(const Point<3,T>& p, - const Point<3,T>& a, - const Point<3,T>& b, - const Point<3,T>& c) { - - typedef Point<3,T> point_type; - - // check if P in vertex region outside A - point_type ab = b - a; - point_type ac = c - a; - point_type ap = p - a; - - // compute scalar products - T d1 = ab * ap; - T d2 = ac * ap; - - if (d1 <= 0. && d2 <= 0.) - return a; // barycentric coordinates (1,0,0) - - // check if P in vertex region outside B - point_type bp = p - b; - - T d3 = ab * bp; - T d4 = ac * bp; - - if (d3 >= 0.0f && d4 <= d3) - return b; // barycentric coordinates (0,1,0) - - // check if P in edge region of AB, if so return projection of P onto AB - T vc = d1*d4 - d3*d2; - if (vc <= 0. && d1 >= 0. && d3 <= 0.) { - T v = d1 / (d1 - d3); - return a + v * ab; // barycentric coordinates (1-v,v,0) - } - - // check if P in vertex region outside C - point_type cp = p - c; - T d5 = ab * cp; - T d6 = ac * cp; - if (d6 >= 0.0f && d5 <= d6) - return c; // barycentric coordinates (0,0,1) - - // check if P in edge region of AC, if so return projection of P onto AC - T vb = d5*d2 - d1*d6; - if (vb <= 0.0f && d2 >= 0.0f && d6 <= 0.0f) { - T w = d2 / (d2 - d6); - return a + w * ac; // barycentric coordinates (1-w,0,w) - } - - // Check if P in edge region of BC, if so return projection of P onto BC - T va = d3*d6 - d5*d4; - if (va <= 0.0f && (d4 - d3) >= 0.0f && (d5 - d6) >= 0.0f) { - T w = (d4 - d3) / ((d4 - d3) + (d5 - d6)); - return b + w * (c - b); // barycentric coordinates (0,1-w,w) - } - - // P inside face region. Compute Q through its barycentric coordinates (u,v,w) - T denom = 1.0f / (va + vb + vc); - T v = vb * denom; - T w = vc * denom; - - return a + ab*v + ac*w; // = u*a + v*b + w*c, u = va*denom = 1.0f - v - w -} - - -template -Point<3,T> closest_point_to_plane(const Point<3,T>& q, const Plane& p) { - - typedef Point<3,T> point_type; - - const point_type& n = p.normal(); - - T t = (n*q - p.distance()) / (n*n); - return q - t * n; -} - -//! Compute the closest point to a triangle -/*! Obtains the plane of the triangle and checks if the point lies inside the - * triangle. If not, it computes the closest point to each of the triangle - * edges. - */ -template -Point<3,T> naive_closest_point_to_triangle(const Point<3,T>& p, - const Point<3,T>& a, - const Point<3,T>& b, - const Point<3,T>& c) { - - typedef Point<3,T> point_type; - - // obtain plane of the triangle - Plane pi(a,b,c); - - // get point in the plane closest to p - point_type q = closest_point_to_plane(p,pi); - - // return if point is within the triangle - if (is_point_in_triangle(q, a, b, c)) - return q; - - // else get the closest point taking into account all edges - - // first edge - q = closest_point_to_segment(p, a, b); - T d = (q-p).sq_norm(); - - // second edge - point_type r = closest_point_to_segment(p, b, c); - - T d2 = (r-p).sq_norm(); - if (d2 < d) { - q = r; - d = d2; - } - - // third edge - r = closest_point_to_segment(p,c,a); - d2 = (r-p).sq_norm(); - if (d2 < d) - q = r; - - // return closest point - return q; -} - - -// intersect point p with velocity v with plane -// the function returns collision time and point of contact -// this function does not consider acceleration -template -std::tuple > -moving_point_against_plane(const Point<3,T>& p, const Point<3,T>& v, Plane& pi) { - - typedef Point<3,T> point_type; - - // compute distance of point to plane - Real dist = pi.normal()*p - pi.distance(); - - // if point already in the plane - if (std::abs(dist) <= 1e-10) - return std::make_tuple(0., p); - - else { - - Real denom = pi.normal()*v; - // no intersection as poin moving parallel to or away from plane - if (denom * dist >= 0.) - return std::make_tuple(inf, point_type()); - - // point moving towards the plane - else { - // point is moving towards the plane - Real t = -dist/denom; - return std::make_tuple(t, p + t*v); - } - } -} - - - -template -std::tuple > -moving_point_against_point(const Point& s1, const Point& s2, /* point centers */ - const Point& v1, const Point& v2) /* point velocities */ { - - typedef Point point_type; - typedef typename Point::value_type value_type; - - // vector between points - point_type s = s2 - s1; - // relative motion of s1 with respect to stationary s0 - point_type v = v2 - v1; - value_type c = s*s; - - // if points within tolerance - if (equal(s.sq_norm(), value_type())) - return std::make_tuple(value_type(), s1); - - value_type epsilon = 2*std::numeric_limits::epsilon();; - - value_type a = v*v; - // if points not moving relative to each other - if (a < epsilon) - return std::make_tuple(inf, point_type()); - - value_type b = v*s; - // if points not moving towards each other - if (b >= 0.) - return std::make_tuple(inf, point_type()); - - value_type d = b*b - a*c; - // if no real-valued root (d < 0), points do not intersect - if (d >= 0.) { - value_type ts = (-b - sqrt(d))/a; - point_type q = s1+v1*ts; - return std::make_tuple(ts, q); - } - return std::make_tuple(inf, point_type()); -} - - -__END_AKANTU__ - - -#endif /* __AKANTU_GEOMETRY_HH__ */ diff --git a/extra_packages/contact_alejandro/src/common/aka_optimize.cc b/extra_packages/contact_alejandro/src/common/aka_optimize.cc deleted file mode 100644 index 3d73659c5..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_optimize.cc +++ /dev/null @@ -1,81 +0,0 @@ -/** - * @file aka_optimize.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief Objects that can be used to carry out optimization - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "aka_common.hh" -#include "aka_optimize.hh" - -__BEGIN_AKANTU__ - -std::ostream& operator<<(std::ostream& os, nlopt::result r) { - - switch (r) { - - case 1: - os<<"NLOPT_SUCCESS: Generic success return value."< - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief Objects that can be used to carry out optimization - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#ifndef __AKANTU_OPTIMIZE_HH__ -#define __AKANTU_OPTIMIZE_HH__ - -#include "aka_config.hh" -#include "aka_common.hh" -#include "aka_point.hh" -#include "solid_mechanics_model.hh" - -#include -#include -#include - - -//#define DEBUG_OPTIMIZE 1 - - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - -typedef array::Array<1,Real> vector_type; -typedef array::Array<2,Real> matrix_type; - -std::ostream& operator<<(std::ostream&, nlopt::result); - - - -enum Optimizator_type { Min_t, Max_t }; - - -//! Class used for optimization -/*! This class is a convenience object that inherits from nlopt::opt and carries - * some routines that are common to a nonlinear optimization. The objects sets - * the optimization algorithm as nlopt::LD_SLSQP, a sequential quadratic programming - * (SQP) algorithm for nonlinearly constrained gradient-based optimization - * (supporting both inequality and equality constraints), based on the - * implementation by Dieter Kraft. - */ -class Optimizator : public nlopt::opt { - - typedef std::vector point_type; - typedef nlopt::opt base_type; - - point_type& x_; //!< Initial guess for the optimization - Real val_; //!< Function value - -public: - - //! Parameter constructor that takes an initial guess and a functor - template - Optimizator(point_type& x0, - functor_type& fn, - Optimizator_type t = Min_t, - nlopt::algorithm alg = nlopt::LD_SLSQP) : - base_type(alg, x0.size()), x_(x0) { - - if (t == Min_t) - this->set_min_objective(functor_type::wrap, &fn); - else - this->set_max_objective(functor_type::wrap, &fn); - - this->set_xtol_rel(1e-4); - } - - //! Carry out the optimization and print result - Real result() { - - optimize(x_, val_); - - cout<<"Optimum value found at location"; - for (size_t i=0; i -struct Distance_minimizator_traits; - - -//! Partial template specialization for a segment -template <> -struct Distance_minimizator_traits<_segment_2> { - - //! Set lower and upper bounds for the master coordinate - static void set_bounds(nlopt::opt &opt) { - - std::vector lb(1,-1), ub(1,1); - opt.set_lower_bounds(lb); - opt.set_upper_bounds(ub); - } - - //! Select the start point between the center or the ends of the segmet - template - static void start(object_type &obj) { - - Real min = std::numeric_limits::infinity(); - std::vector xstart = { -1., 0., 1. }; // check center and extremes of element - int idx = -1; - for (size_t i=0; i grad; // empty vector - Real new_dist = obj(obj.xi_, grad); - if (new_dist < min) { - min = new_dist; - idx = i; - } - } - obj.xi_[0] = xstart[idx]; - } -}; - - -//! Constraint function for a triangle -static Real constrain_triangle_3(const std::vector &xi, std::vector &grad, void *data) { - if (!grad.empty()) { - grad[0] = 1.; - grad[1] = 1.; - } - return (xi[0] + xi[1] - 1.); -} - - -//! Helper class used for the definition of triangle partial template specializations -struct Triangle_minimizator_traits { - - //! Set lower and upper bounds for the master coordinate - static void set_bounds(nlopt::opt &opt) { - - std::vector lb(2, Real()); - opt.set_lower_bounds(lb); - opt.add_inequality_constraint(constrain_triangle_3, NULL, 1e-4); - } - - //! Select the start point between the center or the vertices of the triangle - template - static void start(object_type &obj) { - - Real min = std::numeric_limits::infinity(); - Real xstart[4][2] = { {0.,0.}, {1.,0.}, {0.,1.}, {1./3.,1./3.} }; // check center and corners of element - int idx = -1; - for (int i=0; i<4; ++i) { - obj.xi_[0] = xstart[i][0]; - obj.xi_[1] = xstart[i][1]; - std::vector grad; // empty vector - Real new_dist = obj(obj.xi_, grad); - if (new_dist < min) { - min = new_dist; - idx = i; - } - } - obj.xi_[0] = xstart[idx][0]; - obj.xi_[1] = xstart[idx][1]; - } -}; - - -//! Partial template specialization for a 3-node triangle -template <> -struct Distance_minimizator_traits<_triangle_3> : public Triangle_minimizator_traits {}; - - -//! Partial template specialization for a 6-node triangle -template <> -struct Distance_minimizator_traits<_triangle_6> : public Triangle_minimizator_traits {}; - - - -/*! The Distance_minimizator class template can be used to obtain the closest point - * to a a finite element using the NLopt optimization library. - * \tparam d - The dimension of the problem - * \tparam element_policy - The element type to which the closest point is sought - * The class inherits from Distance_minimizator_traits to take care of functionality - * specific to elements of certain type. The code can be used for elements of type - * _segment_2, _triangle_3, and _triangle_6. The optimization stage is done during the - * constructor by calling the function constructor_common. The closest point is then - * obtained by calling the function point. - */ -template -class Distance_minimizator : public Distance_minimizator_traits { - - friend class Triangle_minimizator_traits; - friend class Distance_minimizator_traits; - - const UInt nb_nodes = ElementClass::getNbNodesPerElement(); - - typedef Distance_minimizator_traits traits_type; - - typedef Point point_type; - - nlopt::opt opt_; //!< Optimizator reference - std::vector xi_; //!< Master coordinate closest to point - vector_type p_; //!< Point to which the distance is minimized - matrix_type XX_; //!< Triangle coordinates - UInt counter_; //!< Optimization iteration counter - Real fmin_; //!< Minimum distance value - - //! Common function called during construction to carry out the minimization - void constructor_common() { - - traits_type::set_bounds(opt_); - - opt_.set_min_objective(wrap, this); - opt_.set_ftol_abs(1e-4); - - // compute start point - traits_type::start(*this); - - // optimize -#ifdef DEBUG_OPTIMIZE - nlopt::result result = opt_.optimize(xi_, fmin_); - if (result > 0) - cout<<"Optimium found in "< - Distance_minimizator(const point_type& p, const point_container& pts) - : opt_(nlopt::LD_SLSQP, d-1), xi_(d-1), p_(d), XX_(nb_nodes,d), counter_() { - - // get triangle and point coordinates - for (UInt i=0; i &X = model.getCurrentPosition(); - const Array &conn = mesh.getConnectivity(el->type); - for (UInt i=0; ielement,i),j); - } - - constructor_common(); - } - - - vector_type operator()(const std::vector &xi) - { - vector_type N(nb_nodes); - vector_type xi2(xi.size(), const_cast(&xi[0])); - ElementClass::computeShapes(xi2, N); - return transpose(XX_)*N; - } - - //! Evaluation of the function and its gradient - Real operator()(const std::vector &xi, std::vector &grad) - { - // increment function evaluation counter - ++counter_; - - vector_type x = (*this)(xi); - vector_type diff = x-p_; - - if (!grad.empty()) { - - // compute shape function derivatives - matrix_type DN(d-1,nb_nodes); - vector_type xi2(xi.size(), const_cast(&xi[0])); - - ElementClass::computeDNDS(xi2, DN); - DN = transpose(DN); - - // compute jacobian - matrix_type J = transpose(XX_)*DN; - - // compute function gradient - vector_type gradF = transpose(J) * diff; - for (UInt i=0; i& master_coordinates() - { return xi_; } - - //! Function that is used to have this class working with nlopt - static double wrap(const std::vector &x, std::vector &grad, void *data) { - return (*reinterpret_cast*>(data))(x, grad); } - -}; - - -__END_AKANTU__ - - -#endif /* __AKANTU_OPTIMIZE_HH__ */ - - diff --git a/extra_packages/contact_alejandro/src/common/aka_plane.hh b/extra_packages/contact_alejandro/src/common/aka_plane.hh deleted file mode 100644 index dafac7684..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_plane.hh +++ /dev/null @@ -1,82 +0,0 @@ -/** - * @file aka_plane.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Sun Sep 26 2010 - * @date last modification: Sun Oct 19 2014 - * - * @brief Geometry class representing planes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_AKA_PLANE_HH__ -#define __AKANTU_AKA_PLANE_HH__ - -#include "aka_point.hh" - - -__BEGIN_AKANTU__ - - - -//! Plane class -struct Plane { - - typedef Point<3> point_type; - typedef point_type::value_type value_type; - - //! Parameter constructor creates a plane out of 3 points - Plane(const point_type& a, const point_type& b, const point_type& c) { - - n_ = cross(b - a, c - a).normalize(); - d_ = n_*a; - } - - //! Return the plane normal - const point_type& normal() const - { return n_; } - - //! Return the disctance to the origin - value_type distance() const - { return d_; } - - //! Standard output stream operator - friend std::ostream& operator<<(std::ostream& os, const Plane& pi) { - - os<<"Plane[normal: "< - * @author David Simon Kammer - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief Geometry class representing points - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_AKA_POINT_HH__ -#define __AKANTU_AKA_POINT_HH__ - -#include "aka_common.hh" -#include - -#include - -__BEGIN_AKANTU__ - - -const Real inf = std::numeric_limits::infinity(); - - -//! Point class template -/*! This class represents the abstraction of a point in d-Euclidian - * space. - * \tparam d - Space dimension - * \tparam T - Type for storing coordinate values - */ -template -class Point { - -public: - - typedef T value_type; - - //! Return the dimension of the point - constexpr static int dim() - { return d; } - - //! Default constructor creates a point on the origin - Point() { - for (UInt i=0; i - explicit Point(const Args&... args) { - - static_assert(sizeof...(Args) <= d , "*** ERROR *** Number of arguments exceeded point dension"); - - std::fill_n(coord_, d, value_type()); - - value_type coord[] = { args... }; - - if (sizeof...(Args) != 0) - for (size_t i=0; i - Point& operator*=(S s) { - for (int i=0; i -Point operator+(const Point& p, const Point& q) { - Point r(p); - return r += q; -} - - -//! Subtraction between two points -template -Point operator-(const Point& p, const Point& q) { - Point r(p); - return r -= q; -} - -//! Overload operator* for the scalar product -template -typename Point::value_type operator*(const Point& p, const Point& q) { - - typename Point::value_type r = 0; - for (int i=0; i -Point operator*(const Point& p, typename Point::value_type s) { - Point r(p); - return r *= s; -} - -//! Multiply a point by a scalar -template -Point operator*(typename Point::value_type s, const Point& p) { - Point r(p); - return r *= s; -} - - -//! Cross product -template -Point<3,T> cross(const Point<3,T>& o, const Point<3,T>& p) { - - Point<3,T> r; - for (int i=0; i<3; ++i) - r[i] = o[(i+1)%3]*p[(i+2)%3] - o[(i+2)%3]*p[(i+1)%3]; - return r; -} - - -//! Bounding volume class template -/*! This class is used as a building block for constructing - * hierarchies of boundign volumes used in the contact detection - * framework. - */ -template -struct Bounding_volume { - - typedef Point point_type; - typedef typename point_type::value_type value_type; - - virtual value_type measure() const = 0; - virtual std::ostream& print(std::ostream& os) const = 0; - - Real last_time_; - point_type velocity_; - point_type acceleration_; - - //! Standard output stream operator - friend std::ostream& operator<<(std::ostream& os, const Bounding_volume& gv) - { return gv.print(os); } -}; - - - - -__END_AKANTU__ - -#endif /* __AKANTU_AKA_POINT_HH__ */ diff --git a/extra_packages/contact_alejandro/src/common/aka_polytope.hh b/extra_packages/contact_alejandro/src/common/aka_polytope.hh deleted file mode 100644 index 6e5ae76cf..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_polytope.hh +++ /dev/null @@ -1,132 +0,0 @@ -/** - * @file aka_polytope.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief k-DOP class template - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_POLYTOPE_HH__ -#define __AKANTU_POLYTOPE_HH__ - -#include "aka_point.hh" - - -__BEGIN_AKANTU__ - - - -//! k-DOP (Discrete Orientation Polytope) class template -/*! \tparam k - Number of planes used to define the polytope - */ -template -class Polytope { - - - Real min_[k / 2]; //! Minimum coordinate value along k/2 directions - Real max_[k / 2]; //! Maximum coordinate value along k/2 directions - -public: - - - //! Parameter constructor that uses a container of points - template - Polytope(const point_container& pts) { - Real inf = std::numeric_limits ::infinity(); - for (size_t i = 0; i < k / 2; ++i) { - min_[i] = inf; - max_[i] = -inf; - } - initialize(pts); - } - - //! Check for collision with another polytope - bool operator& (Polytope & p) { - for (size_t i = 0; i < k / 2; ++i) - if (p.min_[i] > max_[i] || p.max_[i] < min_[i]) - return false; - return true; - } - -private: - - //! Private member function used to initialize the polytope - template - void initialize(const point_container& pts); -}; - - -template <> -template -void Polytope <14>::initialize(const point_container& pts) { - typedef typename point_container::value_type point_type; - - Real c = 0.57735026918963; - - - for (size_t i = 0; i < pts.size(); ++i) { - const point_type& p = pts[i]; - - // set min/max values along axe (±1,0,0), (0,±1,0), (0,0,±1) - for (size_t j = 0; j < point_type::dim(); ++j) { - min_[j] = std::min(min_[j], p[j]); - max_[j] = std::max(max_[j], p[j]); - } - - // set min/max values along axe (1,1,1) and (-1,-1,-1) (normalized) - point_type e1(c, c, c); - - Real f1 = p * e1; - min_[3] = std::min(min_[3], f1); - max_[3] = std::max(max_[3], f1); - - // set min/max values along axe (1,1,-1) and (-1,-1,1) (normalized) - point_type e2(c, c, -c); - - Real f2 = p * e2; - min_[4] = std::min(min_[4], f2); - max_[4] = std::max(max_[4], f2); - - // set min/max values along axe (1,-1,1) and (-1,1,-1) (normalized) - point_type e3(c, -c, c); - - Real f3 = p * e3; - min_[5] = std::min(min_[5], f3); - max_[5] = std::max(max_[5], f3); - - // set min/max values along axe (-1,1,1) and (1,-1,-1) (normalized) - point_type e4(-c, c, c); - - Real f4 = p * e4; - min_[6] = std::min(min_[6], f4); - max_[6] = std::max(max_[6], f4); - } -} - -__END_AKANTU__ - -#endif /* __AKANTU_POLYTOPE_HH__ */ diff --git a/extra_packages/contact_alejandro/src/common/aka_timer.hh b/extra_packages/contact_alejandro/src/common/aka_timer.hh deleted file mode 100644 index 693aae4cf..000000000 --- a/extra_packages/contact_alejandro/src/common/aka_timer.hh +++ /dev/null @@ -1,219 +0,0 @@ -/** - * @file aka_timer.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief timer object - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_TIMER_HH__ -#define __AKANTU_TIMER_HH__ - - -#include -#include -#include -#include - - -__BEGIN_AKANTU__ - - -// time_t tv_sec; /* seconds since Jan. 1, 1970 */ -// suseconds_t tv_usec; /* and microseconds */ - -// time_t -> long -// suseconds_t -> __int32_t - - - -using std::cout; -using std::endl; - -class time { - - typedef std::time_t time_t; - - time_t microseconds_; - time_t seconds_; - time_t minutes_; - time_t hours_; - time_t days_; - -public: - - - explicit time(const timeval& t) - : microseconds_(t.tv_usec), seconds_(t.tv_sec), minutes_(), hours_(), days_() { - adjust(); - } - - - explicit time(time_t ms = 0, time_t s = 0, time_t min = 0, time_t h = 0, time_t d = 0) - : microseconds_(ms), seconds_(s), minutes_(min), hours_(h), days_(d) { - adjust(); - } - - time& operator+=(const timeval& t) { - microseconds_ += t.tv_usec; - seconds_ += t.tv_sec; - adjust(); - return *this; - } - - time& operator+=(const time& t) { - microseconds_ += t.microseconds_; - seconds_ += t.seconds_; - minutes_ += t.minutes_; - hours_ += t.hours_; - days_ += t.days_; - adjust(); - return *this; - } - - time operator+(const time& t2) { - time t(*this); - t += t2; - return t; - } - - friend std::ostream& operator<<(std::ostream& os, const time& t) { - if (t.days_ != 0) - os<= 1000000) { - seconds_ += microseconds_ / 1000000; - microseconds_ = microseconds_ % 1000000; - } - if (seconds_ >= 60) { - minutes_ += seconds_ / 60; - seconds_ = seconds_ % 60; - } - if (minutes_ >= 60) { - hours_ += minutes_ / 60; - minutes_ = minutes_ % 60; - } - if (hours_ >= 24) { - days_ += hours_ / 24; - hours_ = hours_ % 24; - } - } -}; - - -/////////////////////////////////////////////////////////////////////////////// -// timer classes - -template -void subtract(const timeval& x, timeval y, timeval& r) { - - // perform the carry for the later subtraction by updating y - if (x.tv_usec < y.tv_usec) { - int nsec = (y.tv_usec - x.tv_usec) / 1000000 + 1; - y.tv_usec -= 1000000 * nsec; - y.tv_sec += nsec; - } - if (x.tv_usec - y.tv_usec > 1000000) { - int nsec = (x.tv_usec - y.tv_usec) / 1000000; - y.tv_usec += 1000000 * nsec; - y.tv_sec -= nsec; - } - - // compute the time remaining to wait - // tv_usec is certainly positive - r.tv_sec = x.tv_sec - y.tv_sec; - r.tv_usec = x.tv_usec - y.tv_usec; -} - - -class ctimer { - - timeval t1_; - -public: - - ctimer() - { reset(); } - - timeval tac() const { - timeval t2; - gettimeofday(&t2, NULL); - timeval r; - subtract(t2, t1_, r); - return r; - } - - inline void reset() - { gettimeofday(&t1_, NULL); } - - friend std::ostream& operator<<(std::ostream& os, const ctimer& t) { - cout<(tac())/CLOCKS_PER_SEC; } - - friend std::ostream& operator<<(std::ostream& os, const cpu_timer& t) { - os< - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief bounding volume hierarchies - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_TREE_HH__ -#define __AKANTU_TREE_HH__ - -#include -#include -#include -#include -//#include - -#include "aka_ball.hh" -#include "aka_bounding_box.hh" -#include "aka_array.hh" - -//#define DEBUG_TREE 1 - - -__BEGIN_AKANTU__ - - -using std::cout; -using std::endl; - - -struct Tree_node_base -{ - typedef Tree_node_base* base_ptr; - typedef const Tree_node_base* const_base_ptr; - - base_ptr parent_; - base_ptr left_; - base_ptr right_; - - static base_ptr _minimum(base_ptr x) { - while (x->left_ != 0) x = x->left_; - return x; - } - - static const_base_ptr _minimum(const_base_ptr x) { - while (x->left_ != 0) x = x->left_; - return x; - } - - static base_ptr _maximum(base_ptr x) { - while (x->right_ != 0) x = x->right_; - return x; - } - - static const_base_ptr _maximum(const_base_ptr x) { - while (x->right_ != 0) x = x->right_; - return x; - } -}; - -template -struct Tree_node : public Tree_node_base -{ - typedef T value_tpe; - typedef Tree_node* link_type; - - value_tpe value_; - - template - Tree_node(Args&&... args) - : Tree_node_base(), value_(std::forward(args)...) { } -}; - - -// iterators - -static Tree_node_base* local_leaf_increment(Tree_node_base* x) throw () { - - Tree_node_base* y = x->parent_; - if (y->parent_ == x) - return y; - while (x == y->right_) { - x = y; - y = y->parent_; - } - if (y->parent_ == x) - return y; - if (x->right_ != y) - x = y; - if (x->right_ != 0) { - x = x->right_; - while (x->left_ != 0) - x = x->left_; - } - return x; -} - -template -tree_pointer* _tree_leaf_increment(tree_pointer* x) throw () -{ return local_leaf_increment(x); } - -template -const tree_pointer* _tree_leaf_increment(const tree_pointer* x) throw () -{ return local_leaf_increment(const_cast(x)); } - - -template -struct Tree_leaf_iterator -{ - typedef _Tp value_type; - typedef _Tp& reference; - typedef _Tp* pointer; - - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef Tree_leaf_iterator<_Tp> self_type; - typedef Tree_node_base::base_ptr base_ptr; - typedef Tree_node<_Tp>* link_type; - - Tree_leaf_iterator() : node_() { } - - explicit Tree_leaf_iterator(link_type x) : node_(x) { } - - reference operator*() const - { return static_cast(node_)->value_; } - - pointer operator->() const - { return std::__addressof(static_cast(node_)->value_); } - - self_type& operator++() { - node_ = _tree_leaf_increment(node_); - return *this; - } - - self_type operator++(int) { - self_type tmp = *this; - node_ = _tree_leaf_increment(node_); - return tmp; - } - - bool operator==(const self_type& x) const - { return node_ == x.node_; } - - bool operator!=(const self_type& x) const - { return node_ != x.node_; } - - bool operator<(const self_type& x) const - { return node_ < x.node_; } - - base_ptr node_; -}; - - -template -struct Tree_leaf_const_iterator -{ - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - - typedef Tree_leaf_iterator<_Tp> iterator; - - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef Tree_leaf_const_iterator<_Tp> self_type; - typedef Tree_node_base::const_base_ptr base_ptr; - typedef const Tree_node<_Tp>* link_type; - - Tree_leaf_const_iterator() : node_() { } - - explicit Tree_leaf_const_iterator(link_type x) : node_(x) { } - - Tree_leaf_const_iterator(const iterator& it) : node_(it.node_) { } - - iterator _const_cast() const - { return iterator(static_cast(const_cast(node_))); } - - reference operator*() const - { return static_cast(node_)->value_; } - - pointer operator->() const - { return std::__addressof(static_cast - (node_)->value_); } - - self_type& operator++() { - node_ = _tree_leaf_increment(node_); - return *this; - } - - self_type operator++(int) { - self_type tmp = *this; - node_ = _tree_leaf_increment(node_); - return tmp; - } - - bool operator==(const self_type& x) const - { return node_ == x.node_; } - - bool operator!=(const self_type& x) const - { return node_ != x.node_; } - - bool operator<(const self_type& x) const - { return node_ < x.node_; } - - base_ptr node_; -}; - - -template -inline bool operator==(const Tree_leaf_iterator<_Val>& x, - const Tree_leaf_const_iterator<_Val>& y) -{ return x.node_ == y.node_; } - -template -inline bool operator!=(const Tree_leaf_iterator<_Val>& x, - const Tree_leaf_const_iterator<_Val>& y) -{ return x.node_ != y.node_; } - - - -template -static tree_pointer* -local_tree_increment(tree_pointer* x) throw () -{ - if (x->right_ != 0) - { - x = x->right_; - while (x->left_ != 0) - x = x->left_; - } - else - { - tree_pointer* y = x->parent_; - while (x == y->right_) - { - x = y; - y = y->parent_; - } - if (x->right_ != y) - x = y; - } - return x; -} - - -template -tree_pointer* _tree_increment(tree_pointer* x) throw () -{ return local_tree_increment(x); } - -template -const tree_pointer* -_tree_increment(const tree_pointer* x) throw () -{ return local_tree_increment(const_cast(x)); } - -template -static tree_pointer* -local_tree_decrement(tree_pointer* x) throw () { - if (x->parent_->parent_ == x) - x = x->right_; - else if (x->left_ != 0) { - Tree_node_base* y = x->left_; - while (y->right_ != 0) - y = y->right_; - x = y; - } - else { - tree_pointer* y = x->parent_; - while (x == y->left_) { - x = y; - y = y->parent_; - } - x = y; - } - return x; -} - -template -tree_pointer* _tree_decrement(tree_pointer* x) throw () -{ return local_tree_decrement(x); } - -template -const tree_pointer* _tree_decrement(const tree_pointer* x) throw () -{ return local_tree_decrement(const_cast(x)); } - - -// iterators - -template -struct Tree_iterator -{ - typedef _Tp value_type; - typedef _Tp& reference; - typedef _Tp* pointer; - - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef Tree_iterator<_Tp> self_type; - typedef Tree_node_base::base_ptr base_ptr; - typedef Tree_node<_Tp>* link_type; - - typedef Tree_leaf_iterator leaf_iterator; - - - Tree_iterator() : node_() { } - - explicit Tree_iterator(link_type x) : node_(x) { } - - Tree_iterator(const leaf_iterator& it) : node_(it.node_) { } - - reference operator*() const - { return static_cast(node_)->value_; } - - pointer operator->() const - { return std::__addressof(static_cast(node_)->value_); } - - self_type& operator++() { - node_ = _tree_increment(node_); - return *this; - } - - self_type operator++(int) { - self_type tmp = *this; - node_ = _tree_increment(node_); - return tmp; - } - - self_type& operator--() { - node_ = _tree_decrement(node_); - return *this; - } - - self_type operator--(int) { - self_type tmp = *this; - node_ = _tree_decrement(node_); - return tmp; - } - - - self_type left() - { return self_type(static_cast(node_->left_)); } - - self_type right() - { return self_type(static_cast(node_->right_)); } - - self_type parent() - { return self_type(static_cast(node_->parent_)); } - - bool is_leaf() { - assert(node_ != nullptr); - return node_->left_ == nullptr && node_->right_ == nullptr; - } - - - bool operator==(const self_type& x) const - { return node_ == x.node_; } - - bool operator!=(const self_type& x) const - { return node_ != x.node_; } - - bool operator<(const self_type& x) const - { return node_ < x.node_; } - - base_ptr node_; -}; - -template -struct Tree_const_iterator -{ - typedef _Tp value_type; - typedef const _Tp& reference; - typedef const _Tp* pointer; - - typedef Tree_iterator<_Tp> iterator; - - typedef std::bidirectional_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef Tree_const_iterator<_Tp> self_type; - typedef Tree_node_base::const_base_ptr base_ptr; - typedef const Tree_node<_Tp>* link_type; - - Tree_const_iterator() : node_() { } - - explicit Tree_const_iterator(link_type x) : node_(x) { } - - Tree_const_iterator(const iterator& it) : node_(it.node_) { } - - iterator _const_cast() const - { return iterator(static_cast(const_cast(node_))); } - - reference operator*() const - { return static_cast(node_)->value_; } - - pointer operator->() const - { return std::__addressof(static_cast - (node_)->value_); } - - self_type& operator++() { - node_ = _tree_increment(node_); - return *this; - } - - self_type operator++(int) { - self_type tmp = *this; - node_ = _tree_increment(node_); - return tmp; - } - - self_type& operator--() { - node_ = _tree_decrement(node_); - return *this; - } - - self_type operator--(int) { - self_type tmp = *this; - node_ = _tree_decrement(node_); - return tmp; - } - - self_type left() - { return self_type(static_cast(node_->left_)); } - - self_type right() - { return self_type(static_cast(node_->right_)); } - - self_type parent() - { return self_type(static_cast(node_->parent_)); } - - bool is_leaf() { - assert(node_ != nullptr); - return node_->left_ == nullptr && node_->right_ == nullptr; - } - - - bool operator==(const self_type& x) const - { return node_ == x.node_; } - - bool operator!=(const self_type& x) const - { return node_ != x.node_; } - - bool operator<(const self_type& x) const - { return node_ < x.node_; } - - base_ptr node_; -}; - -template -inline bool operator==(const Tree_iterator<_Val>& x, - const Tree_const_iterator<_Val>& y) -{ return x.node_ == y.node_; } - -template -inline bool operator!=(const Tree_iterator<_Val>& x, - const Tree_const_iterator<_Val>& y) -{ return x.node_ != y.node_; } - - - - -// traversal -template -void inorder(iterator_type it, functor_type& fn) { - if (it.node_ == nullptr) - return; - inorder(it.left(), fn); - fn(it); - inorder(it.right(), fn); -} - -template -void preorder(iterator_type it, functor_type& fn) { - if (it.node_ == nullptr) - return; - fn(it); - preorder(it.left(), fn); - preorder(it.right(), fn); -} - -template -void postorder(iterator_type it, functor_type& fn) { - if (it.node_ == nullptr) - return; - postorder(it.left(), fn); - postorder(it.right(), fn); - fn(it); -} - - - -//! Tree class -template class _Cost, typename _Alloc = std::allocator > -class Tree -{ - typedef typename _Alloc::template rebind >::other - _Node_allocator; - - protected: - typedef Tree_node_base* base_ptr; - typedef const Tree_node_base* const_base_ptr; - - public: - - typedef T value_type; - typedef value_type* pointer; - typedef const value_type* const_pointer; - typedef value_type& reference; - typedef const value_type& const_reference; - typedef Tree_node* link_type; - typedef const Tree_node* const_link_type; - typedef size_t size_type; - typedef std::ptrdiff_t difference_type; - typedef _Cost cost_functor; - typedef _Alloc allocator_type; - - _Node_allocator& _get_Node_allocator() - { return *static_cast<_Node_allocator*>(&this->impl_); } - - const _Node_allocator& _get_Node_allocator() const - { return *static_cast(&this->impl_); } - - allocator_type - get_allocator() const - { return allocator_type(_get_Node_allocator()); } - - private: - - link_type _get_node() - { return impl_._Node_allocator::allocate(1); } - - void _put_node(link_type p) - { impl_._Node_allocator::deallocate(p, 1); } - - void _destroy_node(link_type p) { - _get_Node_allocator().destroy(p); - _put_node(p); - } - - link_type _clone_node(const_link_type x) { - link_type tmp = _create_node(x->value_); - tmp->left_ = 0; - tmp->right_ = 0; - return tmp; - } - - template - link_type _create_node(_Args&&... args) { - - link_type tmp = _get_node(); - try { - _get_Node_allocator().construct(tmp, std::forward<_Args>(args)...); - tmp->left_ = 0; - tmp->right_ = 0; - tmp->parent_ = 0; - } - catch(...) { - _put_node(tmp); - throw; - } - return tmp; - } - - private: - - template - struct Tree_impl : public _Node_allocator - { - _Cost_functor cost_; - Tree_node_base header_; - size_type node_count_; // Keeps track of size of tree. - - Tree_impl() - : _Node_allocator(), cost_(), header_(), - node_count_(0) - { _M_initialize(); } - - Tree_impl(const _Cost_functor& comp, const _Node_allocator& a) - : _Node_allocator(a), cost_(comp), header_(), - node_count_(0) - { _M_initialize(); } - - Tree_impl(const _Cost_functor& comp, _Node_allocator&& a) - : _Node_allocator(std::move(a)), cost_(comp), - header_(), node_count_(0) - { _M_initialize(); } - - private: - void - _M_initialize() - { - this->header_.parent_ = 0; - this->header_.left_ = &this->header_; - this->header_.right_ = &this->header_; - } - }; - - private: - - Tree_impl impl_; //!< Tree implementation instance - - base_ptr& _root() - { return this->impl_.header_.parent_; } - - const_base_ptr _root() const - { return this->impl_.header_.parent_; } - - base_ptr& _leftmost() - { return this->impl_.header_.left_; } - - const_base_ptr _leftmost() const - { return this->impl_.header_.left_; } - - base_ptr& _rightmost() - { return this->impl_.header_.right_; } - - const_base_ptr _rightmost() const - { return this->impl_.header_.right_; } - - link_type _begin() - { return static_cast(this->impl_.header_.parent_); } - - const_link_type _begin() const - { return static_cast(this->impl_.header_.parent_); } - - link_type _end() - { return static_cast(&this->impl_.header_); } - - const_link_type _end() const - { return static_cast(&this->impl_.header_); } - - static reference _value(link_type x) - { return x->value_; } - - static const_reference _value(const_link_type x) - { return x->value_; } - - static reference _value(base_ptr x) - { return static_cast(x)->value_; } - - static const_reference _value(const_base_ptr x) - { return static_cast(x)->value_; } - - static link_type _left(base_ptr x) - { return static_cast(x->left_); } - - static const_link_type _left(const_base_ptr x) - { return static_cast(x->left_); } - - static link_type _right(base_ptr x) - { return static_cast(x->right_); } - - static const_link_type _right(const_base_ptr x) - { return static_cast(x->right_); } - - static link_type _parent(base_ptr x) - { return static_cast(x->parent_); } - - static const_link_type _parent(const_base_ptr x) - { return static_cast(x->parent_); } - - - void _erase(link_type x) { - while (x != 0) - { -#ifdef DEBUG_TREE - cout<<"pointer x -> "< "<<_right(x)< "<<_value(x)< "<<_left(x)<parent_ = p; - - try - { - if (x->right_) - top->right_ = _copy(_right(x), top); - p = top; - x = _left(x); - - while (x != 0) - { - link_type y = _clone_node(x); - p->left_ = y; - y->parent_ = p; - if (x->right_) - y->right_ = _copy(_right(x), y); - p = y; - x = _left(x); - } - } - catch(...) - { - _erase(top); - throw; - } - return top; - } - - void _check_integrity(link_type x) { - - while (x != 0) { - - link_type r = _right(x); - if (r) - if (r->parent_ != x) { - cout<<"*** ERROR *** Integrity check failed"<parent_ != x) { - cout<<"*** ERROR *** Integrity check failed"< iterator; - typedef Tree_const_iterator const_iterator; - - typedef std::reverse_iterator reverse_iterator; - typedef std::reverse_iterator const_reverse_iterator; - - typedef Tree_leaf_iterator leaf_iterator; - typedef Tree_leaf_const_iterator const_leaf_iterator; - - - - // allocation/deallocation - Tree() {} - - Tree(const cost_functor& cost, const allocator_type& a = allocator_type()) - : impl_(cost, _Node_allocator(a)) { } - - Tree(const Tree& x) : impl_(x.impl_.cost_, x._get_Node_allocator()) - { - if (x._root() != 0) - { - _root() = _copy(x._begin(), _end()); - _leftmost() = Tree_node_base::_minimum(_root()); - _rightmost() = Tree_node_base::_maximum(_root()); - impl_.node_count_ = x.impl_.node_count_; - } - } - - //! construct a tree from link type, defined by the user in any way - Tree(link_type x) { - - // integrity check - _check_integrity(x); - if (x) _insert(0,x); - } - - - ~Tree() noexcept - { _erase(_begin()); } - - const cost_functor& cost() const - { return impl_.cost_; } - - void clear() noexcept - { - _erase(_begin()); - _leftmost() = _end(); - _root() = 0; - _rightmost() = _end(); - // assert count == 0, _erase should take care of decrementing the node count - assert(impl_.node_count_ == 0); - // impl_.node_count_ = 0; - } - - iterator begin() - { return iterator(static_cast(this->impl_.header_.left_)); } - - const_iterator begin() const - { return const_iterator(static_cast(this->impl_.header_.left_)); } - - iterator end() - { return iterator(static_cast(&this->impl_.header_)); } - - const_iterator end() const - { return const_iterator(static_cast(&this->impl_.header_)); } - - - reverse_iterator rbegin() - { return reverse_iterator(end()); } - - const_reverse_iterator rbegin() const - { return const_reverse_iterator(end()); } - - reverse_iterator rend() - { return reverse_iterator(begin()); } - - const_reverse_iterator rend() const - { return const_reverse_iterator(begin()); } - - - leaf_iterator leaves_begin() - { return leaf_iterator(static_cast(impl_.header_.left_)); } - - const_leaf_iterator leaves_begin() const - { return const_leaf_iterator(static_cast(impl_.header_.left_)); } - - leaf_iterator leaves_end() - { return leaf_iterator(static_cast(&impl_.header_)); } - - const_leaf_iterator leaves_end() const - { return const_leaf_iterator(static_cast(&impl_.header_)); } - - iterator root() - { return iterator(static_cast(impl_.header_.parent_)); } - - const_iterator root() const - { return const_iterator(static_cast(impl_.header_.parent_)); } - - bool empty() const - { return impl_.node_count_ == 0; } - - size_type size() const - { return impl_.node_count_; } - - size_type max_size() const - { return _get_Node_allocator().max_size(); } - - - std::tuple height() const { - - size_t count = 0; - size_t min = std::numeric_limits::max(); - size_t max = 0; - size_t h = 0; - for (const_leaf_iterator it = leaves_begin(); it != leaves_end(); ++it) { - const_base_ptr x = it.node_; - size_t h1 = 0; - while (x->parent_ != _end()) { - ++h1; - x = x->parent_; - } - min = std::min(min, h1); - max = std::max(max, h1); - ++count; - h += h1; - } - - return std::make_tuple(h/count, min, max); - } - - - private: - - void _add_level(std::queue& q, base_ptr x, size_t h, size_t level) { - - if (h < level) { - if (x->left_ != 0) _add_level(q, x->left_, h+1, level); - if (x->right_ != 0) _add_level(q, x->right_, h+1, level); - } - else if (h == level) - q.push(static_cast(x)); - else - return; - } - - - - iterator _insert(base_ptr l, base_ptr r, bool count = true) { - -#ifdef DEBUG_TREE - cout<<"inside inserting two for iterators"<parent_ = p; - - // get left most - base_ptr lt = r; - while (lt->left_ != 0) - lt = lt->left_; - -#ifdef DEBUG_TREE - cout<<"left most -> "<<_value(lt)<(lt)); it != end(); ++it) - ++impl_.node_count_; - - // get right most - base_ptr rt = r; - while (rt->right_ != 0) - rt = rt->right_; - - // if l is not null, create a new node - link_type lr = static_cast(r); - if (l) { - - auto vp = impl_.cost_(_value(l),_value(r)); - lr = _create_node(vp); - ++impl_.node_count_; - - p = _parent(l); - lr->parent_ = p; - lr->right_ = r; - lr->left_ = l; - - r->parent_ = lr; - l->parent_ = lr; - - } else - _leftmost() = lt; - - // fix header - if (lr->parent_ == _end()) { - - _root() = lr; - _rightmost() = rt; - - } else { - // fix parent pointers - if (p->right_ == l) - p->right_ = lr; - else if (p->left_ == l) - p->left_ = lr; - } - - // recursively fix parents - auto fix = _value(lr); - while (lr->parent_ != _end()) { - p = _parent(lr); - fix = impl_.cost_(_value(p), fix); - p->value_ = fix; - lr = p; - } - - return iterator(static_cast(r)); - } - - bool _is_leaf(const_base_ptr x) const - { assert(x != nullptr); return (_right(x) == nullptr) && (_left(x) == nullptr); } - - - - public: - - - struct _Queue_compare { - - // pointer - ancestor expansion - best cost tuples - typedef std::tuple tuple_type; - - bool operator()(const tuple_type& t1, const tuple_type& t2) const - { return std::get<1>(t1) > std::get<1>(t2); } - }; - - //! Adapted from Omohundro:89 routine best_sib - template - iterator best_sibling(Arg&& v) { - -#ifdef DEBUG_TREE - cout<<"--------------------"<, _Queue_compare> queue_type; - - // set result to root - link_type result = _begin(); - - // check for empty tree - if (!result) - return iterator(nullptr); - - // check for leaf node - else if (_is_leaf(result)) - return iterator(result); - - // compute combined cost - Real bcost = impl_.cost_(impl_.cost_(v, _value(result))); - -#ifdef DEBUG_TREE - cout<<"root -> "<<_value(result)< "<(t); - auto aexp = std::get<1>(t); - auto ndvol = std::get<2>(t); - // remove top most element - q.pop(); - -#ifdef DEBUG_TREE - cout<<" inside while"<= bcost) { -#ifdef DEBUG_TREE - cout<<"*** BREAKING"< "<left_))); -#ifdef DEBUG_TREE - cout<<" c left -> "<left_)) - q.push(std::make_tuple(_left(nd), e, c)); - - // do right node - c = impl_.cost_(impl_.cost_(v, _value(nd->right_))); -#ifdef DEBUG_TREE - cout<<" c right -> "<right_)) - q.push(std::make_tuple(_right(nd), e, c)); - - } // while queue is not empty - -#ifdef DEBUG_TREE - cout<<"best sibling -> "<<_value(result)< - iterator cheap_best_sibling(Arg&& v) { - -#ifdef DEBUG_TREE - cout<<"--------------------"< "<<_value(x)< "<left_ && x->right_) { - -#ifdef DEBUG_TREE - cout<<" inside while"< "<= bcost) - break; - else { - - auto lv = impl_.cost_(v, _value(x->left_)); - auto rv = impl_.cost_(v, _value(x->right_)); - -#ifdef DEBUG_TREE - cout<<" c left -> "< "<left_)) <= - rv - impl_.cost_(_value(x->right_))) { - wv = lv; - x = _left(x); - } else { - wv = rv; - x = _right(x); - } - } - } // while loop - -#ifdef DEBUG_TREE - cout<<"best sibling -> "<<_value(result)< - void _execute_at_leaves(iterator x, std::set& visited, functor_type& fn) { - - auto it = visited.find(x.node_); - if (it != visited.end()) - return; - - visited.insert(x.node_); - - if (x.is_leaf()) - fn(x); - else { - if (x.node_->left_ != 0) _execute_at_leaves(iterator(static_cast(x.node_->left_)), visited, fn); - if (x.node_->right_ != 0) _execute_at_leaves(iterator(static_cast(x.node_->right_)), visited, fn); - } - } - - public: - - //! Collect neighbors - /*! This function is used to collect neighbors from a tree given a functor. - * The functor should implement a parameterless and a one-parameter operator() overloads. - * The first load is used as the predicate to finish the search of neighbors, whereas - * the second one is executed at leaves. - */ - template - void collect_neighbors(iterator it, functor_type& fn) { - - // check for null ptr - if (it.node_ == nullptr) - return; - - std::set visited; - - base_ptr p = it.node_; - - // execute while predicate is not true - while (!fn()) { - - p = p->parent_; - - // root node - if (p == _root()->parent_) - break; - - _execute_at_leaves(iterator(static_cast(p)), visited, fn); - } - } - - template - std::pair cheap_insert(Arg&& v) { - - iterator it = cheap_best_sibling(v); - link_type r = _create_node(v); - - return std::pair(_insert(it.node_, r), true); - } - - - template - std::pair insert(Arg&& v) { - - iterator it = best_sibling(v); - link_type r = _create_node(v); - - return std::pair(_insert(it.node_, r), true); - } - - - std::pair insert(link_type x) - { return insert(iterator(x)); } - - std::pair insert(iterator vit) { - - iterator it = best_sibling(_value(vit.node_)); - return std::pair(_insert(it.node_, vit.node_), true); - } - - - iterator sibling(iterator it) { - - base_ptr x = it.node_; - if (!x) - return iterator(nullptr); - if (x == _root()) - return end(); - - base_ptr p = x->parent_; - assert (p != 0); - if (p->left_ == x) - return iterator(_right(p)); - return iterator(_left(p)); - } - - public: - - iterator relocate_parent(iterator it) { - -#if DEBUG_TREE - if (it.node_) - cout<<"relocating node "<<_value(it.node_)<(it.node_); - - - // null pointer - if (!x) - return end(); - - // get parent - link_type p = _parent(x); - - // if parent is header return root - if (p == _end()) - return iterator(_begin()); - - // get grand-parent - link_type gp = _parent(p); - - // no need to recompute volume as the parent has - // the enclosing volume of its children - - // sibling - link_type s = x == p->left_ ? _right(p) : _left(p); - -#ifdef DEBUG_TREE - cout<<"relocating x -> "<<_value(x)< "<<_value(p)< "<<_value(s)<left_ == p) { - gp->left_ = s; -#ifdef DEBUG_TREE - cout<<"setting parent->parent->left to sibling"<right_ == p) { - gp->right_ = s; -#ifdef DEBUG_TREE - cout<<"setting parent->parent->right to sibling"<parent_ = p->parent_; - - // recursively fix parents - link_type r = _parent(s); - while (r != _end()) { - r->value_ = impl_.cost_(_value(r->right_), _value(r->left_)); - r = _parent(r); - } - - // destroy parent node p and reinsert x into the tree - x->parent_ = 0; - p->parent_ = 0; - p->left_ = 0; - p->right_ = 0; - _erase(p); - - // get the best sibling - iterator bit = best_sibling(_value(x)); - -#ifdef DEBUG_TREE - cout<<"best sibling for relocation -> "< "<<_value(bit.node_)<left_ != 0) - lt = lt->left_; - _leftmost() = lt; - - base_ptr rt = _root(); - while (rt->right_ != 0) - rt = rt->right_; - _rightmost() = rt; - - return result; - } - - - iterator erase(iterator it) { - - link_type x = static_cast(it.node_); - - // null pointer - if (!x) - return end(); - - // root node - else if (x == _root()) { - clear(); - return end(); - } - - link_type p = _parent(x); - - link_type s; // sibling - if (x == p->left_) { - s = _right(p); - p->right_ = 0; // set to zero to use erase - } else { - s = _left(p); - p->left_ = 0; - } - -#ifdef DEBUG_TREE - cout<<"erasing x -> "<<_value(x)< "<<_value(p)< "<<_value(s)<left_ != 0) - l = l->left_; - _leftmost() = l; -#ifdef DEBUG_TREE - cout<<"x is leftmost, so setting leftmost to "<<_value(l)<right_ != 0) - r = r->right_; - _rightmost() = r; -#ifdef DEBUG_TREE - cout<<"x is rightmost, so setting rightmost to "<<_value(r)<parent_ = p->parent_; - if (p->parent_ == _end()) { -#ifdef DEBUG_TREE - cout<<"*** WARNING *** sibling new parent is the header!"<parent_->left_ == p) { - p->parent_->left_ = s; -#ifdef DEBUG_TREE - cout<<"setting parent->parent->left to sibling"<parent_->right_ = s; -#ifdef DEBUG_TREE - cout<<"setting parent->parent->right to sibling"< "<right_< "<left_<right_) - cout<<"p right value -> "<<_value(p->right_)<left_) - cout<<"p left value -> "<<_value(p->left_)<value_ = _value(r->right_) + _value(r->left_); - r = _parent(r); - } - - // erase subtree rooted at p - _erase(p); - - return iterator(s); - } - - - - Real volume() const { - Real v = 0; - for (const_iterator it = begin(); it != end(); ++it) - v += it->measure(); - return v; - } - - - friend std::ostream& operator<<(std::ostream& os, const Tree& t) { - - os<<"Tree: count "<parent_<parent_<<", value "<<_value(it.node_->parent_)<left_) - os<<" left: "<left_<<", value "<<_value(it.node_->left_)<right_) - os<<" right: "<right_<<", value "<<_value(it.node_->right_)<left_ && !it.node_->right_) - os<<" leaf"< "< "< "<<*node< "< "<<*pair< "<(tuple)< "<<*best< "<<*parent<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<" pushing new tuple "< "<<*node< "<<*pair< "<(tuple)<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<"BEST SIBLING DOES NOT MATCH!"< "<<*node< "<<*pair< "<(tuple)< -class Volume_creator; - -template -struct Volume_creator > { - - typedef typename Ball::point_type point_type; - - template - static Ball create(const coord_array& coord) { - - std::vector pts; - size_t nnodes = coord.size(); - pts.reserve(nnodes); - for (size_t i=0; i(pts); - } -}; - -template -struct Volume_creator > { - - typedef typename BoundingBox::point_type point_type; - - template - static Sphere create(const coord_array& coord) { - - std::vector pts; - size_t nnodes = coord.size(); - pts.reserve(nnodes); - for (size_t i=0; i(pts.begin(), pts.end()); - } -}; - - - -// bottom up tree construction -template -tree_type* construct_tree_bottom_up(model_type& model) { - - // online tree type definitions - typedef typename tree_type::value_type volume_type; - typedef typename tree_type::cost_functor cost_functor; - typedef typename tree_type::iterator iterator_type; - - // queue type definitions - typedef std::tuple tuple_type; - typedef typename std::priority_queue, Tuple_compare > queue_type; - - // already paired container type definitions - typedef std::set paired_set; - typedef typename paired_set::iterator paired_iterator; - - tree_type* tp = new tree_type(); - tree_type& t = *tp; - const cost_functor& cost = t.cost(); - std::vector links; - - typedef typename model_type::mesh_type mesh_type; - - mesh_type& mesh = model.getMesh(); - int dim = mesh.getSpatialDimension(); - - // iterate over elements of lower dimension - typename mesh_type::type_iterator it = mesh.firstType(dim-1); - typename mesh_type::type_iterator end = mesh.lastType(dim-1); - - size_t numVolumes = 0; - for(; it != end; ++it) { - - // add elements to corresponding surface - for(UInt e = 0; e < mesh.getNbElement(*it); ++e) { - - // create solid mechanics element - element_type el(model, *it, e); - - // vector of coordinates for update - std::vector coord = el.coordinates(); - - // create leaf volume - volume_type v = Volume_creator::create(coord); - - // do not add zero measure volumes - if (v.measure() == 0 && dim != 1) - continue; - - std::pair p = t.insert(v); - assert(p.second); - links.push_back(p.first); - ++numVolumes; - - // save leaf data - if (!t.add_data(p.first,el)) { - cout<<"*** ERROR *** Could not add data. Aborting..."<::infinity(); - - for (size_t j=i+1; j(tuple); - iterator_type pair = std::get<1>(tuple); - - q.pop(); - - paired_iterator it = s.find(node); - if (it != s.end()) - continue; - - it = s.find(pair); - if (it != s.end()) - continue; - -#if DEBUG_TREE - cout< "< "<<*node< "< "<<*pair< "<(tuple)< "<<*best< "<<*parent<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<" pushing new tuple "< "<<*node< "<<*pair< "<(tuple)<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<"BEST SIBLING DOES NOT MATCH!"< "<<*node< "<<*pair< "<(tuple)< -tree_type* construct_tree_bottom_up(element_container& elems) { - - // element type - typedef typename element_container::value_type element_type; - - // online tree type definitions - typedef typename tree_type::value_type volume_type; - typedef typename tree_type::cost_functor cost_functor; - typedef typename tree_type::iterator iterator_type; - - // queue type definitions - typedef std::tuple tuple_type; - typedef typename std::priority_queue, Tuple_compare > queue_type; - - // already paired container type definitions - typedef std::set paired_set; - typedef typename paired_set::iterator paired_iterator; - - tree_type* tp = new tree_type(); - tree_type& t = *tp; - const cost_functor& cost = t.cost(); - std::vector links; - - size_t numVolumes = 0; - - for (typename element_container::iterator it = elems.begin(); - it != elems.end(); ++it) { - - element_type &el = *it; - - // vector of coordinates for update - std::vector coord = el.coordinates(); - - // create leaf volume - volume_type v = Volume_creator::create(coord); - - // do not add zero measure volumes - if (v.measure() == 0) - continue; - - std::pair p = t.insert(v); - assert(p.second); - links.push_back(p.first); - ++numVolumes; - - // save leaf data - if (!t.add_data(p.first,el)) { - cout<<"*** ERROR *** Could not add data. Aborting..."<::infinity(); - - for (size_t j=i+1; j(tuple); - iterator_type pair = std::get<1>(tuple); - - q.pop(); - - paired_iterator it = s.find(node); - if (it != s.end()) - continue; - - it = s.find(pair); - if (it != s.end()) - continue; - -#if DEBUG_TREE - cout< "< "<<*node< "< "<<*pair< "<(tuple)< "<<*best< "<<*parent<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<" pushing new tuple "< "<<*node< "<<*pair< "<(tuple)<(tuple); - iterator_type pair = std::get<1>(tuple); - -#if DEBUG_TREE - cout<<"BEST SIBLING DOES NOT MATCH!"< "<<*node< "<<*pair< "<(tuple)< -void print_mathematica(tree_type& t) { - - typedef typename tree_type::value_type volume_type; - - int d = volume_type::dim(); - - cout< -std::string stringify(const T& x) { - std::stringstream o; - if (!(o << x)) { - cout<<"*** ERROR *** Bad argument to stringity function"< -void export_video(tree& t, Real duration, Real min_opacity, std::string pre = "", std::string post = "") { - - typedef typename tree::value_type volume_type; - typedef typename volume_type::aabb_type aabb_type; - typedef typename aabb_type::point_type point_type; - typedef typename point_type::value_type value_type; - typedef typename tree::iterator iterator; - - int d = volume_type::dim(); - cout< h = t.height(); - - typename tree::iterator it = t.begin(); - - aabb_type bb = it->bounding_box(); - - // get bounding box - for (; it != t.end(); ++it) - bb += it->bounding_box(); - - std::string figs; - int H = std::get<2>(h); - int k = 0; - for (int l = H; l>=0; --l) { - - std::string g = "g"; - g += stringify(k); - ++k; - - // compute opacity for figure - Real opacity = (1 - min_opacity)*static_cast(l)/H + min_opacity; - - if (d == 2) - cout< {{"; - const point_type &m = bb.min(); - const point_type &M = bb.max(); - for (int i=0; i 300];"< "<(k)/duration)<<"];"< -//Tree > -//construct_tree_bottom_up2(const volume_container& volumes) -//{ -// -// typedef typename volume_container::value_type volume_type; -// -// // online tree type definitions -// typedef Tree > tree_type; -// -// typedef Tree_node node_type; -// typedef typename tree_type::link_type link_type; -// -// size_t numVolumes = volumes.size(); -// assert(numVolumes != 0); -// -// // allocate leafs of the tree -// link_type* leafs = new link_type[numVolumes]; -// -// for (size_t i=0; i 1) { -// -// // find indices of the two "nearest" nodes, based on some criterion -// size_t ii,jj; -// Real merged = std::numeric_limits::infinity(); -// for (size_t i=0; ivalue_ + leafs[j]->value_; -// if (v.measure() < merged) { -// ii = i; -// jj = j; -// merged = v.measure(); -// } -// } -// -// volume_type v = leafs[ii]->value_ + leafs[jj]->value_; -// link_type parent = new node_type(v); -// -//#if DEBUG_TREE -// cout<<"best volume found -> "< "< "<value_< "<value_< "<value_<left_ = leafs[ii]; -// parent->right_ = leafs[jj]; -// leafs[ii]->parent_ = parent; -// leafs[jj]->parent_ = parent; -// -// // remove the two nodes from the active set and add in the new node. -// leafs[ii] = parent; -// leafs[jj] = leafs[numVolumes - 1]; -// --numVolumes; -// } -// -// link_type root = leafs[0]; -// -// tree_type t(root); -// -// delete leafs; -// -// return t; -//} - -__END_AKANTU__ - -#endif /* __AKANTU_TREE_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/contact_common.hh b/extra_packages/contact_alejandro/src/contact/contact_common.hh deleted file mode 100644 index fd78619fa..000000000 --- a/extra_packages/contact_alejandro/src/contact/contact_common.hh +++ /dev/null @@ -1,167 +0,0 @@ -/** - * @file contact_common.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief Forward declarations for contact classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_CONTACT_COMMON_HH__ -#define __AKANTU_CONTACT_COMMON_HH__ - -#include - -#include "aka_visitor.hh" -#include - -#include "cppargparse.hh" - -//#define DEBUG_CONTACT 1 - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - -typedef array::Array<1, Real> vector_type; -typedef array::Array<2, Real> matrix_type; - -using array::transpose; - -//! Enumerated type used for the Contact overloaded operator[] that returns real -// values -enum Contact_parameter_type { - Epsilon, - Alpha, - Multiplier_tol, - Newton_tol, - Multiplier_max_steps, - Newton_max_steps -}; - -//! Enumerated type used for the Contact overloaded operator[] that returns -// boolean values -enum Contact_flag_type { - Verbose, - Automatic_penalty_parameter -}; - -//! Discretization types -enum Discretization_type { - Node_to_node, - Node_to_segment, - Segment_to_segment -}; - -//! Contact type -enum Contact_type { - Self_contact, - No_self_contact -}; - -struct EmptyType {}; -class NullType {}; - -//! This functor is called when the visitor is not implemented for a particular -// object. -template struct Discretization_visitor_default { - template R operator()(T &t) { - cout << "*** WARNING *** No implementation for discretization visitor" - << endl; - } -}; - -template class Contact_discretization; - -typedef Contact_discretization N2N_c; -typedef Contact_discretization N2S_c; -typedef Contact_discretization S2S_c; - -template -struct SelectResolution { - constexpr static const AnalysisMethod analysis = s; - constexpr static const ContactResolutionMethod method = r; - constexpr static const ContactImplementationMethod implementation = i; -}; - -template -class ContactResolution; - -template class Search_policy, class Resolution_policy> -class Contact; - -// parsers -extern cppargparse::ArgumentParser contact_argparser; -extern Parser contact_parser; - -class ContactParameters { -protected: - typedef std::map options_map; - typedef std::map flag_map; - - options_map options_; - flag_map flags_; - -public: - //! Overloaded operator[] (const) that returns real values - Real operator[](Contact_parameter_type p) const { - auto it = options_.find(p); - assert(it != options_.end()); - return it->second; - } - - //! Overloaded operator[] (non-const) that returns real values - Real &operator[](Contact_parameter_type p) { return options_[p]; } - - //! Overloaded operator[] (const) that returns flags - bool operator[](Contact_flag_type f) const { - auto it = flags_.find(f); - return it->second; - } - - //! Overloaded operator[] (non-const) that returns bool values - bool &operator[](Contact_flag_type p) { return flags_[p]; } - - virtual void initialize() {} -}; - -template T Heaviside(T v) { return v < 0 ? 0 : 1; } - -template T Macauley(T v) { return v < 0 ? 0 : v; } - -template array::Array<2, value_type> eye(UInt d) { - array::Array<2, value_type> I(d); - - for (UInt i = 0; i < d; ++i) - I(i, i) = 1.; - return I; -} - -__END_AKANTU__ - -#endif /* __AKANTU_CONTACT_COMMON_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/contact_impl.cc b/extra_packages/contact_alejandro/src/contact/contact_impl.cc deleted file mode 100644 index 49d7017e4..000000000 --- a/extra_packages/contact_alejandro/src/contact/contact_impl.cc +++ /dev/null @@ -1,42 +0,0 @@ -/** - * @file contact_impl.cc - * - * @author Alejandro M. Aragón - * @author Clement Roux - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief Contat class Interface - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -__BEGIN_AKANTU__ - -/// Paser for commandline arguments -::cppargparse::ArgumentParser contact_argparser; - -/// Parser containing the information parsed by the input file given to initFull -Parser contact_parser; - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/contact_impl.hh b/extra_packages/contact_alejandro/src/contact/contact_impl.hh deleted file mode 100644 index 3e7595d8b..000000000 --- a/extra_packages/contact_alejandro/src/contact/contact_impl.hh +++ /dev/null @@ -1,97 +0,0 @@ -/** - * @file contact_impl.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief Contact interface class - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -// -// contact.hh -// akantu -// -// Created by Alejandro Marcos Aragón on 6/24/14. -// -// - -#ifndef __AKANTU_CONTACT_HH__ -#define __AKANTU_CONTACT_HH__ - - -#include "contact_common.hh" -#include "parser.hh" -#include "search.hh" -#include "resolution.hh" - -__BEGIN_AKANTU__ - -template class Search_policy, class RP> -class Contact : public Search_policy, public ContactResolution { - - typedef SolidMechanicsModel model_type; - typedef Search_policy search_type; - typedef ContactResolution resolution_type; - -public: - Contact(int argc, char *argv[], model_type & m) : search_type(m), resolution_type(m) - { - // read parameters from file - std::pair - sub_sect = getStaticParser().getSubSections(_st_contact); - - if (sub_sect.first != sub_sect.second) - this->parseSection(*sub_sect.first); - - // read parameters the command line - contact_argparser.parse(argc, argv, cppargparse::_remove_parsed); - - // finish initialization of resolution class - this->initialize(); - } - - - //! Provide standard output of contact object - friend std::ostream& operator << (std::ostream & os, const Contact &cd) { - const resolution_type& r(cd); - const search_type& s(cd); - - os << "\nContact object info:" << endl; - os << " Search type: " << s << endl; - os << " Resolution type: " << r << endl; - return os; - } -}; - - -template -void solveContactStep(contact_type& c) -{ c.solveContactStep(&c); } - - - -__END_AKANTU__ - - -#endif /* __AKANTU_CONTACT_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/contact_manager.hh b/extra_packages/contact_alejandro/src/contact/contact_manager.hh deleted file mode 100644 index ecc112ce4..000000000 --- a/extra_packages/contact_alejandro/src/contact/contact_manager.hh +++ /dev/null @@ -1,432 +0,0 @@ -/** - * @file contact_manager.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact manager - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_CMANAGER_HH__ -#define __AKANTU_CMANAGER_HH__ - -#include "aka_common.hh" -#include "surface.hh" -#include "zone.hh" -#include "element.hh" - - -__BEGIN_AKANTU__ - - -template -class BBox_sorter { - - typedef CSurface surface_type; - - struct Comparator { - - template - bool operator()(surface_pointer s1, surface_pointer s2) const { - - typedef typename surface_type::bbox_type bbox_type; - - auto b1 = s1->bounding_box(); - auto b2 = s2->bounding_box(); - - // consider min point for sorting (chosen arbitrarily) - return b1.min(d-1) < b2.min(d-1); - // NOTE: point coordinates are 0-based, so calling d-1 with - // dimension 2 actually gets the second element of the - // coordinate array - } - }; - -public: - - template - static std::pair check(pointer p1, pointer p2) { - typedef std::pair contact_pair; - return p1 < p2 ? contact_pair(p1,p2) : contact_pair(p2,p1); - } - - template - static void sort(surface_container& surfaces, intersection_container& intersections) { - - typedef typename surface_container::value_type surface_ptr; - typedef typename surface_type::bbox_type bbox_type; - - typedef typename surface_container::iterator surface_iterator; - typedef typename intersection_container::value_type contact_pair; - - // sort container - surfaces.sort(Comparator()); - - // loop over sorted surfaces - surface_iterator it1 = surfaces.begin(); - surface_iterator it2 = ++surfaces.begin(); - for (; it2 != surfaces.end(); ++it2) { - - // check for intersection of bounding boxes - auto b1 = (*it1)->bounding_box(); - auto b2 = (*it2)->bounding_box(); - - // if bounding boxes intersect - if (b1 & b2) { - // add pair to set - intersections.insert(check(*it1,*it2)); - ++it1; - - } else { - - // remove pair from set - intersections.erase(check(*it1,*it2)); - - // remove first surface from container, as it does not - // intersect other surfaces - surfaces.erase(it1++); - } - } - - if (surfaces.size() > 1) - BBox_sorter::sort(surfaces, intersections); - } - -}; - -//! Partial template specialization for zero dimension -/*! This class finishes the recursion on dimension by doing nothing in the - * sort function. - */ -template <> -struct BBox_sorter<0> { - - template - static void sort(surface_container&, intersection_container&) {} -}; - -template -class CManager { - - typedef SolidMechanicsModel model_type; - typedef CSurface contact_surface; - typedef std::vector surface_container; - typedef typename surface_container::iterator surface_iterator; - typedef typename surface_container::const_iterator const_surface_iterator; - - typedef CZone contact_zone; - typedef std::list zone_container; - typedef typename zone_container::iterator zone_iterator; - typedef typename zone_container::const_iterator const_zone_iterator; - - typedef CElement contact_element; - typedef std::list celement_container; - typedef typename celement_container::const_iterator celement_iterator; - - SolidMechanicsModel &model_; - surface_container surfaces_; - zone_container zones_; - celement_container celements_; - Contact_type c_; - -public: - - void clear() { - - zones_.clear(); - celements_.clear(); - } - - CManager(model_type& model, Contact_type c = No_self_contact_t) : model_(model), c_(c) { - - // get mesh from model - Mesh &mesh = model.getMesh(); - - // call update current position to be able to call later - // the function to get current positions - model.updateCurrentPosition(); - - // obtain exterior surfaces - MeshUtils::buildFacets(mesh); - - // assign surface ids - MeshUtils::buildSurfaceID(mesh); - - // allocate memory for surfaces - UInt nb_surfaces = mesh.getNbSurfaces(); - surfaces_.reserve(nb_surfaces); - - for (UInt i=0; i &conn = mesh.getConnectivity(*it); - - Array &surf_id = mesh.getSurfaceID(*it); - - // add elements to corresponding surface - for(UInt e = 0; e < nb_element; ++e) { - - CSurface &surface = surfaces_.at(surf_id(e)); - surface.add_element(*it,e); - - // add element nodes to surface - for (UInt n = 0; n surface_list; - typedef std::pair contact_pair; - typedef std::set intersection_container; - typedef typename intersection_container::iterator intersection_iterator; - typedef typename contact_surface::bbox_type bbox_type; - - // create container of bounding boxes used for the sort and - // the container to store intersections - surface_list list; - intersection_container intersections; - - // loop over surfaces to update bounding boxes - for (surface_iterator it = surfaces_.begin(); it != surfaces_.end(); ++it) { - - const contact_surface &surface = *it; - it->update_bounding_box(); - list.push_back(&surface); - } - - // carry out sort in all dimensions to check for intersections - BBox_sorter::sort(list, intersections); - - if (!intersections.empty()) { - - // loop over intersections to find contact zones - for (intersection_iterator it = intersections.begin(); - it != intersections.end(); ++it) { - - // get contact surfaces that intersect - const contact_surface &surface1 = *it->first; - const contact_surface &surface2 = *it->second; - - // find intersection bounding box - bbox_type bb = surface1.bounding_box() && surface2.bounding_box(); - - // find elements that intersect with the above bounding box - std::set intersected_elements; - surface1.intersects(bb, intersected_elements); - -#if DEBUG_CONTACT - UInt inter = intersected_elements.size(); - cout<<"Surface 1 contains "<first); - const Element* closest = NULL; - - // flagged nodes in case that a node belongs to several buckets - // (node in bucket boundaries) - node_set flaggedNodes; - - // loop over nodes - for (node_iterator nit1 = bit->second.begin(); nit1 != bit->second.end(); ++nit1) { - - auto np = *nit1; - - // node has already been considered for a contact element, - // do nothing further with it - node_iterator fit = flaggedNodes.find(np); - if (fit != flaggedNodes.end()) - continue; - - Real m = std::numeric_limits::infinity(); - - // loop over elements - for (element_iterator sit = contiguous.begin(); sit != contiguous.end(); ++sit) { - - // checkf if no self-contact is allowed - if (c_ == No_self_contact_t) - if (cs.in_surface(np, *sit)) { -#ifdef DEBUG_CONTACT - cout<<"*** INFO *** Node "<element<<" belong to the same surface"<(np, *sit, model_); - - if (length < m) { - m = length; - closest = *sit; - } - - } // loop over elements - - // if a close node was found that does not belong to the - // same element, add contact element for resolution - if (closest) { - celements_.push_back(contact_element(np, closest, model_)); - flaggedNodes.insert(np); - } -#ifdef DEBUG_CONTACT - else - cout<<"*** INFO *** No close element was found for node "<penetrates(); - - if (flag) { -#ifdef DEBUG_CONTACT - cout<<"*** WARNING *** Penetration occurs for element "<<*eit<remove_penetration(); - } - - } - - // clear non-permanent objects - clear(); - } - - void print_celements(std::ostream& os) { - os<<" Contact elements: "< - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - diff --git a/extra_packages/contact_alejandro/src/contact/discretization.hh b/extra_packages/contact_alejandro/src/contact/discretization.hh deleted file mode 100644 index c219b13a6..000000000 --- a/extra_packages/contact_alejandro/src/contact/discretization.hh +++ /dev/null @@ -1,130 +0,0 @@ -/** - * @file discretization.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact discretization classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_DISCRETIZATION_HH__ -#define __AKANTU_DISCRETIZATION_HH__ - -//#include -//#include -//#include - -#include - - -#include "aka_common.hh" -//#include "aka_types.hh" -//#include "contact_common.hh" -//#include "solid_mechanics_model.hh" -#include "solid_mechanics_model_element.hh" -//#include "friction.hh" - -using std::endl; -using std::cout; - -__BEGIN_AKANTU__ - - - -class Discretization_base { - //! Support the visitor design pattern -// virtual void accept(Contact_discretization_visitor&) = 0; -}; - - -template -class Contact_discretization; - -//template <> -//class Contact_discretization : public Discretization_base { -// -// template friend class Contact_scheme; -// -//private: -// -// // pair structure -// struct N2N_pair { -// -// typedef UInt node_id; -// -// node_id master_, slave_; -// bool contact_, stick_; -// vector_type n_; -// }; -// -// -//}; - - - -//template <> -//class Contact_discretization : public Discretization_base { -// -// -// typedef SolidMechanicsModel model_type; -// typedef ModelElement element_type; -// -// typedef std::map slave_master_map; -// typedef std::map real_map; -// -// typedef typename real_map::iterator real_iterator; -// typedef std::map gap_map; -// -// slave_master_map sm_; -// real_map areas_, gaps_; -// -//public: -// -// //! Add slave -// void addSlave(UInt s) -// { sm_[s] = element_type(); } -// -// //! Add slave-master pair -// void addPair(UInt s, element_type el) -// { sm_[s] = el; } -// -// //! Add area to a slave node -// void addArea(UInt n, Real a) -// { if (a != 0.) areas_[n] = a; } -// -// -//// //! Member function to support the visitor design pattern. -//// void accept(Contact_discretization_visitor& guest) -//// { guest.GenericVisit(*this); } -// -//}; - - - - -__END_AKANTU__ - -#endif /* __AKANTU_DISCRETIZATION_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/element.cc b/extra_packages/contact_alejandro/src/contact/element.cc deleted file mode 100644 index 060881c80..000000000 --- a/extra_packages/contact_alejandro/src/contact/element.cc +++ /dev/null @@ -1,306 +0,0 @@ -/** - * @file element.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact element classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "element.hh" -#include "aka_math.hh" -#include "aka_geometry.hh" - -#if defined(AKANTU_BOOST_CHRONO) && !defined(AKANTU_NDEBUG) -# include -#endif - -__BEGIN_AKANTU__ - - -template <> -bool check_penetration<2>(UInt node, const Element* el, SolidMechanicsModel& model) { - - typedef Point<2> point_type; - - Mesh& mesh = model.getMesh(); - const Array &x = model.getCurrentPosition(); - const Array &conn = mesh.getConnectivity(el->type); - - point_type r(&x(node)); - - // NOTE: switch on a enumerated type is a sign of a bad - // object-oriented design - switch (el->type) { - case _segment_2: - { - // get element extreme points - point_type p(&x(conn(el->element,0))); - point_type q(&x(conn(el->element,1))); - - return left_turn(p, q, r) > 0; - } - break; - - default: - cout<<"*** ERROR *** Function signed measure in file "<<__FILE__<<", line "<<__LINE__; - cout<<", is not implemented for element of type "<type< -bool check_penetration<3>(UInt node, const Element* el, SolidMechanicsModel& model) { - - typedef Point<3> point_type; - - Mesh& mesh = model.getMesh(); - const Array &x = model.getCurrentPosition(); - const Array &conn = mesh.getConnectivity(el->type); - - point_type r(&x(node)); - - // NOTE: switch on a enumerated type is a sign of a bad - // object-oriented design - switch (el->type) { - - case _triangle_3: - { - // get element extreme points - point_type o(&x(conn(el->element,0))); - point_type p(&x(conn(el->element,1))); - point_type q(&x(conn(el->element,2))); - - // get signed volume - point_type po = o - p; - point_type pq = q - p; - point_type pr = r - p; - - // cross product - point_type c = cross(pq, po); - - Real v = pr*c; - return v < 0; - } - break; - - default: - cout<<"*** ERROR *** Function signed measure in file "<<__FILE__<<", line "<<__LINE__; - cout<<", is not implemented for element of type "<type< -Point<2> minimize_distance<2>(UInt node, const Element* el, SolidMechanicsModel& model) { - - const UInt d = 2; - typedef Point point_type; - - const Array &x = model.getCurrentPosition(); - - point_type r(&x(node)); - - // NOTE: switch on a enumerated type is a sign of a bad - // object-oriented design - switch (el->type) { - case _segment_2: - { -#if AKANTU_OPTIMIZATION - Distance_minimzer<_segment_2> data(&x(node), el, model); - return data.point(); -#else - AKANTU_DEBUG_ERROR("To use this function you should activate the optimization at compile time"); - return Point<2>(); -#endif - } - break; - - default: - cout<<"*** ERROR *** Function signed measure in file "<<__FILE__<<", line "<<__LINE__; - cout<<", is not implemented for element of type "<type< -Point<3> minimize_distance<3>(UInt node, const Element* el, SolidMechanicsModel& model) { - - const UInt d = 3; - typedef Point point_type; - - const Array &x = model.getCurrentPosition(); - - point_type r(&x(node)); - - // NOTE: switch on a enumerated type is a sign of a bad - // object-oriented design - switch (el->type) { - - case _triangle_3: - { -#if AKANTU_OPTIMIZATION - Distance_minimzer<_triangle_3> data(&x(node), el, model); - -#if defined(AKANTU_BOOST_CHRONO) && !defined(AKANTU_NDEBUG) - typedef boost::chrono::high_resolution_clock clock_type; - typedef typename clock_type::time_point time_type; - time_type start = clock_type::now(); -#endif - data.optimize(); - -#if defined(AKANTU_BOOST_CHRONO) && !defined(AKANTU_NDEBUG) - boost::chrono::nanoseconds ns = clock_type::now() - start; - cout<(); -#endif - - - -// const UInt nb_nodes = 3; -// -// // get triangle coordinates from element and point coordinates -// Mesh& mesh = model.getMesh(); -// std::vector pts(nb_nodes); -// -// const Array &conn = mesh.getConnectivity(el->type); -// for (UInt i=0; ielement,i),j); -// -// // get closest point -// time_type start = clock_type::now(); -// -// Point<3> q = naive_closest_point_to_triangle(r,pts[0],pts[1],pts[2]); -// -// boost::chrono::nanoseconds ns = clock_type::now() - start; -// cout< 1e-2) { -//// cout<<++k< "< pts(nb_nodes); -// -// const Array &conn = mesh.getConnectivity(el->type); -// for (UInt i=0; ielement,i),j); -// -// // get closest point -// time_type start2 = clock_type::now(); -// -// Point<3> q = closest_point_to_triangle(r,pts[0],pts[1],pts[2]); -// -// boost::chrono::nanoseconds ns2 = clock_type::now() - start2; -// cout< 1e-8) { -// cout<<"diff -> "< "< data(&x(node), el, model); -#if defined(AKANTU_BOOST_CHRONO) && !defined(AKANTU_NDEBUG) - time_type start = clock_type::now(); -#endif - data.optimize(); - -#if defined(AKANTU_BOOST_CHRONO) && !defined(AKANTU_NDEBUG) - boost::chrono::nanoseconds ns = clock_type::now() - start; - cout<(); -#endif - } - break; - - default: - cout<<"*** ERROR *** Function signed measure in file "<<__FILE__<<", line "<<__LINE__; - cout<<", is not implemented for element of type "<type< - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact element classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_CELEMENT_HH__ -#define __AKANTU_CELEMENT_HH__ - -#include - -#include "aka_common.hh" -#include "aka_point.hh" -#include "solid_mechanics_model.hh" -#include "mesh.hh" -#include "contact_common.hh" -#if AKANTU_OPTIMIZATION -# include "aka_optimize.hh" -#endif - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - - -// compute signed measure, used to find out if a node penetrates or not -template -bool check_penetration(UInt node, const Element* el, SolidMechanicsModel& model); - -template -Point minimize_distance(UInt node, const Element* el, SolidMechanicsModel& model); - - -template -Real distance(UInt node, const Element* el, SolidMechanicsModel& model) { - - typedef Point point_type; - - const Array &x = model.getCurrentPosition(); - - // get point of node - point_type o(&x(node)); - - // compute closest location within the element to master node - point_type p = minimize_distance(node, el, model); - - return sqrt((o-p).sq_norm()); -} - - -template -class CElement { - - typedef Point point_type; - typedef const Element* element_pointer; - - UInt master_; //!< Slave node - element_pointer element_; //!< Master surface element - SolidMechanicsModel& model_; - -public: - - CElement(UInt n, element_pointer el, SolidMechanicsModel& model) : master_(n), element_(el), model_(model) {} - - //! Checks if there is penetration between the master node and the element - bool penetrates() const { -#ifdef DEBUG_CONTACT - cout<<"*** INFO *** Checking penetration for"<<*this<(master_, element_, model_); - } - - void remove_penetration() const { - -#ifdef DEBUG_CONTACT - cout<<"*** INFO *** Removing penetration for master node "<(master_, element_, model_); - - cout<<"after calling minimize"< "< &X = model_.getDisplacement(); - const Array &coord = model_.getMesh().getNodes(); - for (UInt i=0; i &x = cel.model_.getCurrentPosition(); - - UInt nb_nodes = mesh.getNbNodesPerElement((cel.element_)->type); - const Array &conn = mesh.getConnectivity((cel.element_)->type); - - os<<" Contact element: "<element, i))); - os< - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact friction classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "friction.hh" - -__BEGIN_AKANTU__ - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/friction.hh b/extra_packages/contact_alejandro/src/contact/friction.hh deleted file mode 100644 index 29e89eafa..000000000 --- a/extra_packages/contact_alejandro/src/contact/friction.hh +++ /dev/null @@ -1,98 +0,0 @@ -/** - * @file friction.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact friction classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_FRICTION_HH__ -#define __AKANTU_FRICTION_HH__ - -#include -#include - - -#include "aka_common.hh" - -__BEGIN_AKANTU__ - -using std::cout; -using std::endl; - - -enum Friction_type { Coulomb_t, Prakash_Clifton_t, Rate_state_t, Rice_t }; - - -// base class for all contract friction concrete classes, -// used so that friction classes can be stored in a container -// if needed -struct Contact_friction_base {}; - -template -class Contact_friction; - -// partial template specialization for Coulomb friction -template <> -class Contact_friction : public Contact_friction_base { - - typedef Contact_friction_base base_type; - typedef Real value_type; - -protected: - value_type mu_; // coefficient of friction - -public: - - Contact_friction() : base_type(), mu_() {} - Contact_friction(value_type mu) : base_type(), mu_(mu) {} - - void setFriction(value_type mu) - { mu_ = mu; } - - value_type friction() const - { return mu_; } - - value_type computeForceMagnitude(value_type Pn) - { return mu_*Pn; } - - template - value_type computeForceMagnitude(const vector_type& P) { - - value_type norm = value_type(); - for (int i=0; i - * - * @date creation: Fri Apr 13 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact resolution classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_RESOLUTION_HH__ -#define __AKANTU_RESOLUTION_HH__ - -#include "resolution_augmented_lagrangian.hh" - - -#endif /* __AKANTU_RESOLUTION_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.cc b/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.cc deleted file mode 100644 index 5e415fbd4..000000000 --- a/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.cc +++ /dev/null @@ -1,1283 +0,0 @@ -/** - * @file resolution_augmented_lagrangian.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact resolution classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -//#include "resolution_augmented_lagrangian.hh" - -#include "resolution_augmented_lagrangian.hh" - -#define COUT(name) std::cout << std::string(#name) << ": " << name << std::endl; - -__BEGIN_AKANTU__ - -template -void ContactResolution::initialize() { - - // give priority to command line arguments instead of those in a file - if (contact_argparser.has("aka_penalty")) - options_[Epsilon] = contact_argparser["aka_penalty"]; - else - flags_[Automatic_penalty_parameter] = true; - if (contact_argparser.has("aka_alpha")) - options_[Alpha] = contact_argparser["aka_alpha"]; - if (contact_argparser.has("aka_utol")) - options_[Multiplier_tol] = contact_argparser["aka_utol"]; - if (contact_argparser.has("aka_ntol")) - options_[Newton_tol] = contact_argparser["aka_ntol"]; - if (contact_argparser.has("aka_usteps")) - options_[Multiplier_max_steps] = contact_argparser["aka_usteps"]; - if (contact_argparser.has("aka_nsteps")) - options_[Newton_max_steps] = contact_argparser["aka_nsteps"]; - if (contact_argparser.has("aka_verbose")) - flags_[Verbose] = true; -} - -template -ContactResolution::ContactResolution( - model_type &m) - : Parsable(_st_contact), model_(m), - multiplier_dumper_(m.getMesh().getNbNodes(), 3), - pressure_dumper_(m.getMesh().getNbNodes(), 3) { - // register dumpers - m.getMesh().addDumpFieldExternal("multipliers", multiplier_dumper_); - m.getMesh().addDumpFieldExternal("pressure", pressure_dumper_); - - // register parameters from the file - registerParam("penalty", options_[Epsilon], _pat_parsable, - "Penalty parameter for Augmented-Lagrangian formulation"); - registerParam("alpha", options_[Alpha], 1., _pat_parsable, - "Multiplier for values of the penalty parameter"); - registerParam("utol", options_[Multiplier_tol], 1e-4, _pat_parsable, - "Tolerance used for multipliers in the Uzawa method"); - registerParam("ntol", options_[Newton_tol], 1e-4, _pat_parsable, - "Tolerance used in the Newton-Raphson inner convergence loop"); - registerParam("usteps", options_[Multiplier_max_steps], 100., _pat_parsable, - "Maximum number of steps allowed in the Uzawa loop"); - registerParam("nsteps", options_[Newton_max_steps], 100., _pat_parsable, - "Maximum number of steps allowed in the Newton-Raphson loop"); - - // register parameters from the command line - contact_argparser.addArgument( - "--aka_penalty", "Penalty parameter for Augmented-Lagrangian formulation", - 1, cppargparse::_float); - contact_argparser.addArgument( - "--aka_alpha", "Multiplier for values of the penalty parameter", 1, - cppargparse::_float); - contact_argparser.addArgument( - "--aka_utol", "Tolerance used for multipliers in the Uzawa method", 1, - cppargparse::_float); - contact_argparser.addArgument( - "--aka_ntol", - "Tolerance used in the Newton-Raphson inner convergence loop", 1, - cppargparse::_float); - contact_argparser.addArgument( - "--aka_usteps", "Maximum number of steps allowed in the Uzawa loop", 1, - cppargparse::_float); - contact_argparser.addArgument( - "--aka_nsteps", - "Maximum number of steps allowed in the Newton-Raphson loop", 1, - cppargparse::_float); - contact_argparser.addArgument("--aka_verbose", "Verbose output flag", 0, - cppargparse::_boolean); -} - -template -void -ContactResolution::solveContactStepImpl( - SearchBase *sp, Int2Type<_generalized_newton> gn) { - - ContactResolution &cd = *this; - - model_.implicitPred(); - model_.updateResidual(); - - AKANTU_DEBUG_ASSERT(model_.stiffness_matrix != NULL, - "You should first initialize the implicit solver and " - "assemble the stiffness matrix"); - - //** comments that start like this will comment on the work that has to be - //** done for the implementation of the frictional terms in the code - - UInt k = 0; - UInt ntotal = 0; - - std::list nt; - - // get global stiffness matrix and force vector - SparseMatrix &K = model_.getStiffnessMatrix(); - Array &F = model_.getResidual(); - - // get size of the whole system - UInt original = model_.increment->getSize() * Dim; - UInt size = original + sm_.size(); - - //** the size variable at this point is computed by adding only the number - //** of slave nodes because for each slave node there's a lagrangian - //** multiplier for the normal contact assigned to it. In the case of - //** frictional contact, this variable will have to account for 2 (3) - //** multipliers for each in slave node in 2D (3D), accounting for the - //** tangential components. - - contact_status_ = std::map(); - status_change_ = std::map(); - - size_t ccc = 0; - for (auto g : gaps_) { - if (std::abs(g.second) <= 1.e-10) { - contact_status_[g.first] = true; - ++ccc; - } - } - - Array solution(size); - Array rhs(size); - rhs.clear(); - - // extend data structures to consider Lagrange multipliers - K.resize(size); - - //** with the right value of the 'size' variable, all these data structures - //** will be resized accordingly - - cout << std::boolalpha; - - if (cd[Verbose]) - cout << "- Start Generalized Newton:" << endl; - - UInt j = 0; - - bool converged = false; - bool converged_multiplier = false; - - Real fnorm = 0; - - do { - Real nerror = 0.; - - cd.niter_ = j; - - // assemble material matrix - model_.assembleStiffnessMatrix(); - - // copy residual to rhs - std::copy_n(F.storage(), original, rhs.storage()); - - // compute contribution to tangent matrix and residual - Real dummy; - computeTangentAndResidual(solution, rhs, sp, dummy, gn); - - //** The computeTangentAndResidual is where the major development for the - //** frictional part will take place. - //** All the terms coded in this function into the stiffness matrix and the - //** force vector take into account only the normal contact component. The - //** implementation of the frictional part will include terms for the - //** tangential multipliers. The process I followed for the implementation - //** was to code the stiffness matrix terms from the book by Laursen - //** (Computational Contact and Impact Mechanics). I then took the terms - //** involving the lagrangian multiplier part from the thesis by Grzegorz - //** Pietrzak (Continuum mechanics modelling and augmented Lagrangian - //** formulation of large deformation frictional contact problems) as - //** these terms were missing in the Laursen book. Some little changes had - //** to be made into these terms, as Laursen and Pietrzak use different - //** conventions for the sign of the gap function. In Pietrzak's thesis, - //** the residual terms are given following Eqn. 6.20 (page 146), and the - //** stiffness terms in following equation 6.25 (page 149). - //** I suggest to start by the implementation of the Uzawa method, as it is - //** not required to code the tangential lagrangian multiplier terms of - //** Pietrzak - - // solve - model_.template solve( - solution, 1., true, true, rhs); - - // copy the solution of the system to increment for the primal variable only - std::copy_n(solution.begin(), model_.increment->getSize() * Dim, - model_.increment->storage()); - - // copy the solution of the system to increment for the lagrange multiplier - size_t m = 0; - std::vector multiplier_check(multipliers_.size()); - vector_type v_old(multipliers_.size()); - vector_type v_new(v_old); - for (auto &pair : multipliers_) { - - v_old[m] = pair.second; - v_new[m] = v_old[m] + solution[original + m]; - - multiplier_check[m] = pair.second; - multipliers_[pair.first] += solution[original + m]; - multiplier_check[m] -= pair.second; - ++m; - } - - Real sum_multiplier = 0.; - for (auto m : multiplier_check) - sum_multiplier += m * m; - - //** this check basically computes the L_2 norm of the lagrange multiplier - //** difference, so this test may change when implementing the frictional - //** part - - Real mnorm = sqrt(sum_multiplier); - Real abs_tol = cd[Multiplier_tol]; - - if (j == 0) - fnorm = mnorm; - - converged_multiplier = - (mnorm <= abs_tol || mnorm <= abs_tol * abs_tol * fnorm); - - model_.implicitCorr(); - model_.updateResidual(); - - converged = - model_.template testConvergence<_scc_increment>(cd[Newton_tol], nerror); - - if (cd[Verbose]) { - - size_t w = 10; - cout << std::setw(2) << j << ": Primal: " << std::setw(w) - << std::setprecision(4) << std::right << nerror - << " <= " << cd[Newton_tol] << " = " << std::left << std::setw(5) - << (nerror < cd[Newton_tol]) << " \tDual: " << std::setw(w) - << std::setprecision(4) << std::right << mnorm - << " <= " << cd[Multiplier_tol] << " = " - << (mnorm <= cd[Multiplier_tol]) << ", " << std::setw(w) << mnorm - << " <= " << abs_tol * abs_tol * fnorm << " = " - << (mnorm <= abs_tol * abs_tol * fnorm) << endl; - } - - ++j; - AKANTU_DEBUG_INFO("[" << _scc_increment << "] Convergence iteration " - << std::setw(std::log10(cd[Newton_max_steps])) << j - << ": error " << nerror << (converged ? " < " : " > ") - << cd[Newton_tol] << std::endl); - } while (!(converged && converged_multiplier) && j < cd[Newton_max_steps]); - - if (j == cd[Newton_max_steps]) { - cout << "*** ERROR *** Newton-Raphson loop did not converge within max " - "number of iterations: " << cd[Newton_max_steps] << endl; - exit(1); - } - - nt.push_back(j); - ntotal += j; - - AKANTU_DEBUG_INFO("[" << _scc_increment << "] Uzawa convergence iteration " - << std::setw(std::log10(cd[Newton_max_steps])) << k - << std::endl); - - cout << "Generalized Newton iterations: " << j << endl; - - // dump vtk files - this->dump(); -} - -template -void -ContactResolution::solveContactStepImpl( - SearchBase *sp, Int2Type<_uzawa> uz) { - - ContactResolution &cd = *this; - - model_.implicitPred(); - model_.updateResidual(); - - AKANTU_DEBUG_ASSERT(model_.stiffness_matrix != NULL, - "You should first initialize the implicit solver and " - "assemble the stiffness matrix"); - - //** comments that start like this will comment on the work that has to be - //** done for the implementation of the frictional terms in the code - - // implementation of the Uzawa method for solving contact - bool uzawa_converged = false; - static UInt step = 0; - UInt k = 0; - UInt ntotal = 0; - - std::list nt; - - std::ofstream ofs; - ofs.open("iterations.out", std::ofstream::out | std::ofstream::app); - - // initialize Lagrange multipliers - // NOTE: It doesn't make any difference to start from the previous - // converged solution of Lagrange multipliers - real_map lambda_new; - - cout << std::boolalpha; - - if (cd[Verbose]) - cout << "- Start Uzawa:" << endl; - - do { - Real uerror = 0.; - - bool converged = false; - UInt j = 0; - - cd.uiter_ = k; - - do { - Real nerror = 0.; - - cd.niter_ = j; - - // assemble material matrix - model_.assembleStiffnessMatrix(); - - // compute contribution to tangent matrix and residual - uzawa_converged = computeTangentAndResidual(lambda_new, sp, uerror, uz); - - //** The computeTangentAndResidual is where the major development for the - //** frictional part will take place. - //** All the terms coded in this function into the stiffness matrix and - //** the force vector take into account only the normal contact component. - //** The implementation of the frictional part will include terms for the - //** tangential multipliers. The process I followed for the implementation - //** was to code the stiffness matrix terms from the book by Laursen - //** (Computational Contact and Impact Mechanics). - //** I suggest you start by the implementing the Uzawa method first, - //** before jumping to the more involved implementation of the tangential - //** lagrangian multiplier terms of Pietrzak - - // solve - model_.template solve( - *model_.increment, 1., true, true); - - model_.implicitCorr(); - model_.updateResidual(); - - converged = model_.template testConvergence<_scc_increment>( - cd[Newton_tol], nerror); - - if (cd[Verbose]) - cout << " Newton: " << j << ", " << nerror << " < " << cd[Newton_tol] - << " = " << (nerror < cd[Newton_tol]) << endl; - - ++j; - AKANTU_DEBUG_INFO("[" << _scc_increment << "] Convergence iteration " - << std::setw(std::log10(cd[Newton_max_steps])) << j - << ": error " << nerror - << (converged ? " < " : " > ") << cd[Newton_tol] - << std::endl); - } while (!converged && j < cd[Newton_max_steps]); - - if (cd[Verbose]) - cout << " Uzawa: " << k << ", " << uerror << " < " << cd[Multiplier_tol] - << " = " << (uerror < cd[Multiplier_tol]) << endl; - - if (j == cd[Newton_max_steps]) { - cout << "*** ERROR *** Newton-Raphson loop did not converge within max " - "number of iterations: " << cd[Newton_max_steps] << endl; - exit(1); - } - - nt.push_back(j); - ntotal += j; - - // increment uzawa loop counter - ++k; - - AKANTU_DEBUG_INFO("[" << _scc_increment << "] Uzawa convergence iteration " - << std::setw(std::log10(cd[Newton_max_steps])) << k - << std::endl); - - // update lagrange multipliers - cd.multipliers_ = lambda_new; - } while (!uzawa_converged && k < cd[Multiplier_max_steps]); - - if (k == cd[Multiplier_max_steps]) { - cout << "*** ERROR *** Uzawa loop did not converge within max number of " - "iterations: " << cd[Multiplier_max_steps] << endl; - exit(1); - } - - cout << "Summary: Uzawa [" << k << "]: Newton [" << ntotal << "]:"; - for (int n : nt) - cout << " " << n; - cout << endl; - - ofs << std::setw(10) << ++step << std::setw(10) << k << std::setw(10) - << ntotal << endl; - ofs.close(); - - this->dump(); -} - -template -void ContactResolution::dump() { - - multiplier_dumper_.clear(); - pressure_dumper_.clear(); - - for (auto v : multipliers_) { - element_type &el = sm_[v.first]; - - if (el == element_type()) - continue; - - auto n = el.normal(); - - Real lambda = v.second; - - for (size_t i = 0; i < n.size(); ++i) - multiplier_dumper_(v.first, i) = lambda * n[i]; - - // dump pressures only if area is associated with node - auto it = areas_.find(v.first); - if (it != areas_.end()) - for (size_t i = 0; i < n.size(); ++i) { - Real a = it->second; - assert(a != 0.); - pressure_dumper_(v.first, i) = lambda * n[i] / a; - } - else - cout << "*** WARNING *** Zero area for slave node " << v.first << endl; - } - model_.dump(); -} - -template -void -ContactResolution::getPenaltyValues() { - cout << "*** INFO *** Obtaining penalty parameters automatically. "; - - const SparseMatrix &Kconst = model_.getStiffnessMatrix(); - - Real ave = 0.; - size_t k = 0; - - // loop over pairs - for (auto it = sm_.begin(); it != sm_.end(); ++it) { - auto slave = it->first; - auto master = it->second; - - if (master != element_type()) { - std::vector conn(master.numNodes() + 1); // 1 slave (not hardcoded) - - conn[0] = slave; - for (UInt i = 0; i < master.numNodes(); ++i) - conn[1 + i] = master.node(i); - - // compute normal - vector_type nu = master.normal(); - - // carry out stiffness multiplication with the normal - // the product Kij*nj would give the force for a unit displacement - // (i.e., the stiffness needed to move the node by 1) - matrix_type r(Kconst.getSize(), master.numNodes() + 1); - - // loop over stifness matrix dimension - for (size_t i = 0; i < Kconst.getSize(); ++i) - // loop over problem dimensions - for (int j = 0; j < Dim; ++j) - // loop over nodes considered - for (size_t k = 0; k < master.numNodes() + 1; ++k) - r(i, k) += Kconst(i, conn[k] + j) * nu(j); - - // get results (norm of each column in r) - vector_type rsum(master.numNodes() + 1); - - for (size_t i = 0; i < rsum.size(); ++i) - for (size_t j = 0; j < r.rows(); ++j) - rsum(i) += r(j, i) * r(j, i); - - // get average value as the penalty parameter - Real epsilon = 0.; - for (size_t i = 0; i < rsum.size(); ++i) - epsilon += sqrt(rsum(i)); - - epsilon /= master.numNodes() + 1; - penalty_[slave] = epsilon; - - ave += penalty_[slave]; - ++k; - } - // dummy master - else { - // carry out stiffness multiplication with the normal - // the product Kij*nj would give the force for a unit displacement - // (i.e., the stiffness needed to move the node by 1) - vector_type r(Kconst.getSize()); - - // loop over stifness matrix dimension - for (size_t i = 0; i < Kconst.getSize(); ++i) - // loop over problem dimensions - for (int j = 0; j < Dim; ++j) - // loop over nodes considered - r(i) += Kconst(i, slave + j) * 1. / Dim; - - // get results (norm of each column in r) - Real epsilon = 0; - for (size_t i = 0; i < r.size(); ++i) - epsilon += r(i) * r(i); - - epsilon = sqrt(epsilon); - penalty_[slave] = epsilon; - - ave += penalty_[slave]; - ++k; - } - } - cout << "Average value: " << (*this)[Alpha] * ave / k << endl; -} - -template struct TangentTraits; - -template <> struct TangentTraits<2> { - - constexpr static UInt dim = 2; - constexpr static ElementType master_type = _segment_2; - constexpr static InterpolationType interpolation_type = - _itp_lagrange_segment_2; - - typedef Point point_type; - typedef array::Array<1, Real> vector_type; - typedef array::Array<2, Real> matrix_type; - typedef SolidMechanicsModel model_type; - - template - static bool projects(const point_type &s, const element_type &master, - const Array &position) { - - return has_projection(s, point_type(&position(master.node(0))), - point_type(&position(master.node(1)))); - } - - template - static std::tuple - computeTangentAndResidual(model_type &model, real_tuple t, - element_type &master, const vector_type &sh, - const matrix_type &dsh, const vector_type &N) { - - const Array &position = model.getCurrentPosition(); - - Real gap = std::get<0>(t); - Real s1 = std::get<1>(t); - Real s2 = std::get<2>(t); - - // compute the point on the surface - point_type a(&position(master.node(0))); - point_type b(&position(master.node(1))); - - vector_type nu = master.normal(); - - // compute vector T - point_type tau = dsh(0, 0) * a + dsh(0, 1) * b; - vector_type T(dim * (master.numNodes() + 1)); - - for (UInt i = 0; i < dim; ++i) { - T[i] = tau[i]; - for (UInt j = 0; j < master.numNodes(); ++j) - T[(1 + j) * dim + i] = -tau[i] * sh[j]; - } - - // compute N1 - vector_type N1(dim * (master.numNodes() + 1)); - - for (UInt i = 0; i < dim; ++i) { - for (UInt j = 0; j < master.numNodes(); ++j) - N1[(1u + j) * dim + i] = -nu[i] * dsh(0u, j); - } - - // compute m11 - Real m11 = tau * tau; - - // compute D1 - vector_type D1 = T + gap * N1; - D1 *= 1. / m11; - - // Note: N1bar = N1 - k11*D1, but since k11 = 0 for 2D, then - // N1bar = N1 - vector_type &N1bar = N1; - - // stiffness matrix (only non-zero terms for 2D implementation) - matrix_type kc = s1 * N * transpose(N); // first term - kc += (s2 * gap * m11) * N1bar * transpose(N1bar); // second term - kc -= s2 * D1 * transpose(N1); // sixth term - kc -= s2 * N1 * transpose(D1); // eight term - - // residual vector - vector_type fc = s2 * N; - - assert(kc.rows() == fc.size()); - - return std::make_tuple(kc, fc); - } - - template - static std::tuple - compute_projection(const point_type &s, element_type &master) { - - Distance_minimizator dm(s, master.coordinates()); - vector_type xi(1, dm.master_coordinates()[0]); - return std::make_tuple(dm.point(), xi); - } -}; - -template <> struct TangentTraits<3> { - - constexpr static UInt dim = 3; - constexpr static ElementType master_type = _triangle_3; - constexpr static InterpolationType interpolation_type = - _itp_lagrange_triangle_3; - - typedef Point point_type; - typedef array::Array<1, Real> vector_type; - typedef array::Array<2, Real> matrix_type; - typedef SolidMechanicsModel model_type; - - template - static bool projects(const point_type &s, const element_type &master, - const Array &position) { - - return point_has_projection_to_triangle( - s, point_type(&position(master.node(0))), - point_type(&position(master.node(1))), - point_type(&position(master.node(2)))); - } - - template - static std::tuple - computeTangentAndResidual(model_type &model, real_tuple t, - element_type &master, const vector_type &sh, - const matrix_type &dsh, const vector_type &N) { - - const Array &position = model.getCurrentPosition(); - - Real gap = std::get<0>(t); - Real s1 = std::get<1>(t); - Real s2 = std::get<2>(t); - Real s3 = std::get<3>(t); - - // compute the point on the surface - point_type a(&position(master.node(0))); - point_type b(&position(master.node(1))); - point_type c(&position(master.node(2))); - - vector_type nu = master.normal(); - - point_type tau1 = dsh(0, 0) * a + dsh(0, 1) * b + dsh(0, 2) * c; - point_type tau2 = dsh(1, 0) * a + dsh(1, 1) * b + dsh(1, 2) * c; - - vector_type nucheck(3); - - Math::vectorProduct3(&tau1[0], &tau2[0], &nucheck[0]); - Math::normalize3(&nucheck[0]); - - if ((nucheck - nu)().norm() > 1.0e-10) { - cout << "*** ERROR *** Normal failed" << endl; - cout << "nu1: " << nu << endl; - cout << "nu2: " << nucheck << endl; - exit(1); - } - - // compute vectors T1, T2, N1, N2 - size_t vsize = dim * (master.numNodes() + 1); - vector_type T1(vsize), T2(vsize), N1(vsize), N2(vsize); - for (UInt i = 0; i < dim; ++i) { - T1[i] = tau1[i]; - T2[i] = tau2[i]; - for (UInt j = 0; j < master.numNodes(); ++j) { - T1[(1 + j) * dim + i] = -tau1[i] * sh[j]; - T2[(1 + j) * dim + i] = -tau2[i] * sh[j]; - N1[(1 + j) * dim + i] = -nu[i] * dsh(0u, j); - N2[(1 + j) * dim + i] = -nu[i] * dsh(1u, j); - } - } - - // compute matrix A = m + k*g (but kappa is zero for linear elements) - Real A11 = tau1 * tau1; - Real A12 = tau1 * tau2; - Real A22 = tau2 * tau2; - Real detA = A11 * A22 - A12 * A12; - - // compute vectors D1, D2 - vector_type D1 = - (1 / detA) * (A22 * (T1 + gap * N1)() - A12 * (T2 + gap * N2)())(); - vector_type D2 = - (1 / detA) * (A11 * (T2 + gap * N2)() - A12 * (T1 + gap * N1)())(); - - // Note: N1bar = N1 - k12*D2, but since k12 = 0 for linear elements, then - // N1bar = N1, N2bar = N2 - vector_type &N1bar = N1; - vector_type &N2bar = N2; - - // stiffness matrix (only non-zero terms for 3D implementation with linear - // elements) - - // get covariant terms (det(A) = det(inv(A)) - Real m11 = A22 / detA; - Real m12 = -A12 / detA; - Real m22 = A11 / detA; - - // 1st term: - // epsilon * Heaviside(lambda + epsilon gap) * N * N' = s1 * N * N' - matrix_type kc = s1 * N * transpose(N); - // 2nd term: - // t_N * gap * m_11 * N1_bar * N1_bar', where t_N = - kc += (s3 * m11) * N1bar * transpose(N1bar); - // 3rd and 4th terms: - // t_N * gap * m_12 * (N1_bar * N2_bar' + N2_bar * N1_bar') - matrix_type tmp = N1bar * transpose(N2bar); - tmp += N2bar * transpose(N1bar); - kc += (s3 * m12) * tmp; - // 5th term: - // t_N * gap * m_22 * N2_bar * N2_bar' - kc += (s3 * m22) * N2bar * transpose(N2bar); - // 6th term: - // - t_N * D1 * N1' - kc -= s2 * D1 * transpose(N1); - // 7th term: - // - t_N * D2 * N2' - kc -= s2 * D2 * transpose(N2); - // 8th term: - // - t_N * N1 * D1' - kc -= s2 * N1 * transpose(D1); - // 9th term: - // - t_N * N2 * D2' - kc -= s2 * N2 * transpose(D2); - - // residual vector - vector_type fc = s2 * N; - assert(kc.rows() == fc.size()); - - return std::make_tuple(kc, fc); - } - - //! Function template specialization for inversion of a \f$ 3 \times 3 \f$ - // matrix. - template - static std::pair invert(matrix_type &A) { - // obtain determinant of the matrix - Real det = A[0][0] * (A[1][1] * A[2][2] - A[1][2] * A[2][1]) - - A[0][1] * (A[1][0] * A[2][2] - A[1][2] * A[2][0]) + - A[0][2] * (A[1][0] * A[2][1] - A[1][1] * A[2][0]); - - // compute inverse - matrix_type inv(3, 3, 1. / det); - - inv[0][0] *= A[1][1] * A[2][2] - A[1][2] * A[2][1]; - inv[0][1] *= A[0][2] * A[2][1] - A[0][1] * A[2][2]; - inv[0][2] *= -A[0][2] * A[1][1] + A[0][1] * A[1][2]; - inv[1][0] *= A[1][2] * A[2][0] - A[1][0] * A[2][2]; - inv[1][1] *= A[0][0] * A[2][2] - A[0][2] * A[2][0]; - inv[1][2] *= A[0][2] * A[1][0] - A[0][0] * A[1][2]; - inv[2][0] *= -A[1][1] * A[2][0] + A[1][0] * A[2][1]; - inv[2][1] *= A[0][1] * A[2][0] - A[0][0] * A[2][1]; - inv[2][2] *= -A[0][1] * A[1][0] + A[0][0] * A[1][1]; - - return std::make_pair(inv, det); - } - - template - static vector_type invert_map(const point_type &s, const point_type &a, - const point_type &b, const point_type &c) { - typedef array::Array<2, Real> matrix_type; - - // matrix for inverse - matrix_type A = { { b[0] - a[0], c[0] - a[0], a[0] }, - { b[1] - a[1], c[1] - a[1], a[1] }, - { b[2] - a[2], c[2] - a[2], a[2] } }; - - std::pair Ainv = invert(A); - vector_type x = { s[0], s[1], s[2] }; - vector_type r1 = Ainv.first * x; - - return vector_type{ r1[0], - r1[1] }; // return only the first two components of r1 - } - - template - static std::tuple - compute_projection(const point_type &s, element_type &master) { - - auto coord = master.coordinates(); - - // compute the point on the surface - point_type a(coord[0]); - point_type b(coord[1]); - point_type c(coord[2]); - - point_type p = closest_point_to_triangle(s, a, b, c); - vector_type xi = invert_map(p, a, b, c); - - // Distance_minimizator::master_type> dm( - // s, master.coordinates()); - // xi = vector_type(dim - 1); - // for (int i = 0; i < dim - 1; ++i) - // xi[i] = dm.master_coordinates()[i]; - // point_type p = dm.point(); - return std::make_tuple(p, xi); - } -}; - -template -bool ContactResolution:: - computeTangentAndResidual(real_map &lambda_new, SearchBase *cp, Real &error, - Int2Type<_uzawa>) { - - const Array &position = model_.getCurrentPosition(); - const Real tol = (*this)[Multiplier_tol]; - - // get global stiffness matrix and force vector - SparseMatrix &K = model_.getStiffnessMatrix(); - Array &F = model_.getResidual(); - const Array &eqnum = - model_.getDOFSynchronizer().getLocalDOFEquationNumbers(); - - static bool auto_flag = true; - if (auto_flag) { - auto_flag = false; - if (!(*this)[Automatic_penalty_parameter]) { - Real epsilon = (*this)[Epsilon]; - for (auto it = sm_.begin(); it != sm_.end(); ++it) - penalty_[it->first] = epsilon; - cout << "*** INFO *** Uniform penalty parameter used for all slaves: " - << epsilon << endl; - ; - } - // else get penalty values automatically - else - getPenaltyValues(); - } - - Real lm_diff = 0; - Real lm_max = 0; - - auto it = sm_.begin(); - while (it != sm_.end()) { - auto slave = it->first; - - Real epsilon = (*this)[Alpha] * penalty_[slave]; - AKANTU_DEBUG_ASSERT(epsilon != 0, "Penalty value cannot be zero"); - - // get slave point - point_type s(&position(slave)); - - auto master = it->second; - bool no_master = master == element_type(); - - // if node lies outside triangle - if (no_master || !TangentTraits::projects(s, master, position)) { - - auto r = cp->search(&position(slave)); - - // try to find a new master - if (r != -1) { - it->second = master = - element_type(model_, TangentTraits::master_type, r); - } - // else remove master-slave pair from simulation - else { - master = element_type(); - - gaps_.erase(slave); - lambda_new.erase(slave); - ++it; - continue; - } - } - - assert(master.type == TangentTraits::master_type); - - Distance_minimizator::master_type> dm( - s, master.coordinates()); - - vector_type xi = vector_type(dim - 1); - for (int i = 0; i < dim - 1; ++i) - xi[i] = dm.master_coordinates()[i]; - - point_type p = dm.point(); - - // compute normal - vector_type nu = master.normal(); - point_type nup(static_cast(nu.data())); - - // compute and save gap - Real gap = -(nup * (s - p)); - gaps_[slave] = gap; - - Real lambda_hat = multipliers_[slave] + epsilon * gap; - - if (lambda_hat < 0) { - // increase iterator - ++it; - // save value of lambda - lambda_new[slave] = 0; - continue; - } - - Real s1 = epsilon * Heaviside(lambda_hat); - Real s2 = Macauley(lambda_hat); // max(0,lambda_hat) - Real s3 = s2 * gap; - - std::vector conn(master.numNodes() + 1); // 1 slave (not hardcoded) - conn[0] = slave; - for (UInt i = 0; i < master.numNodes(); ++i) - conn[1 + i] = master.node(i); - - // evaluate shape functions at slave master coordinate - vector_type sh(master.numNodes()); - InterpolationElement::interpolation_type>::computeShapes( - xi, sh); - - // compute vector N - vector_type N(dim * (master.numNodes() + 1)); - for (UInt i = 0; i < dim; ++i) { - N[i] = nu[i]; - for (UInt j = 0; j < master.numNodes(); ++j) - N[(1 + j) * dim + i] = -nu[i] * sh[j]; - } - - matrix_type dsh(dim - 1, master.numNodes()); - InterpolationElement::interpolation_type>::computeDNDS( - xi, dsh); - - // obtain contribution to stiffness matrix and force vector depending on - // the dimension - auto t = TangentTraits::computeTangentAndResidual( - model_, std::make_tuple(gap, s1, s2, s3), master, sh, dsh, N); - - matrix_type &kc = std::get<0>(t); - vector_type &fc = std::get<1>(t); - - // assemble local components into global matrix and vector - std::vector eq; - for (UInt i = 0; i < conn.size(); ++i) - for (UInt j = 0; j < dim; ++j) - eq.push_back(eqnum(conn[i] * dim + j)); - - for (UInt i = 0; i < kc.rows(); ++i) { - F[eq[i]] += fc(i); - for (UInt j = i; j < kc.columns(); ++j) { - K.addToProfile(eq[i], eq[j]); - K(eq[i], eq[j]) += kc(i, j); - } - } - - // update multiplier - lambda_new[slave] = s2; - - Real lm_old = multipliers_[slave]; - lm_max += lm_old * lm_old; - lm_old -= s2; - lm_diff += lm_old * lm_old; - - // increase iterator - ++it; - } - - if (lm_max < tol) { - error = sqrt(lm_diff); - return sqrt(lm_diff) < tol; - } - - error = sqrt(lm_diff / lm_max); - return sqrt(lm_diff / lm_max) < tol; -} - -template -Point<2, T> -closest_point_to_triangle(const Point<2, T> &p, const Point<2, T> &a, - const Point<2, T> &b, const Point<2, T> &c) { - return Point<2, T>(); -} - -template -bool ContactResolution:: - computeTangentAndResidual(Array &solution, Array &F, - SearchBase *cp, Real &error, - Int2Type<_generalized_newton>) { - - const Array &position = model_.getCurrentPosition(); - - // get global stiffness matrix and force vector - SparseMatrix &K = model_.getStiffnessMatrix(); - const Array &eqnum = - model_.getDOFSynchronizer().getLocalDOFEquationNumbers(); - - static bool auto_flag = true; - if (auto_flag) { - auto_flag = false; - if (!(*this)[Automatic_penalty_parameter]) { - Real epsilon = (*this)[Epsilon]; - for (auto it = sm_.begin(); it != sm_.end(); ++it) - penalty_[it->first] = epsilon; - cout << "*** INFO *** Uniform penalty parameter used for all slaves: " - << epsilon << endl; - ; - - } - // else get penalty values automatically - else - getPenaltyValues(); - } - - // size of original system - UInt original = model_.increment->getSize() * dim; - - // multiplier count - size_t kk = 0; - - auto it = sm_.begin(); - while (it != sm_.end()) { - auto slave = it->first; - - Real epsilon = (*this)[Alpha] * penalty_[slave]; - - if (status_change_[slave] != 0) { - - ; - epsilon *= (status_change_[slave] + 1.); - } - - AKANTU_DEBUG_ASSERT(epsilon != 0, "Penalty value cannot be zero"); - - // get slave point - point_type s(&position(slave)); - - auto master = it->second; - bool no_master = master == element_type(); - - static std::map excluded; - - // if node lies outside triangle - if (no_master || !TangentTraits::projects(s, master, position)) { - - auto r = cp->search(&position(slave)); - - // try to find a new master - if (r != -1) { - it->second = master = - element_type(model_, TangentTraits::master_type, r); - no_master = false; - } - // else remove master-slave pair from simulation - else { - master = element_type(); - no_master = true; - excluded[slave] = true; - } - } - - Real gap; - vector_type xi; - - if (!no_master) { - - assert(master.type == TangentTraits::master_type); - - auto tuple = TangentTraits::compute_projection(s, master); - point_type &p = std::get<0>(tuple); - xi = std::get<1>(tuple); - - // compute normal - vector_type nu = master.normal(); - point_type nup(static_cast(nu.data())); - - // Real old_gap = gaps_[slave]; - - // compute and save gap - gap = -(nup * (s - p)); - gaps_[slave] = gap; - - // track status - // if node in contact - if (contact_status_[slave]) { - if (gap < -1.e-10) { - contact_status_[slave] = false; - ++status_change_[slave]; - // cout<<"["<= -1.e-10) { - contact_status_[slave] = true; - ++status_change_[slave]; - // cout<<"["< conn(master.numNodes() + 1); // 1 slave (not hardcoded) - conn[0] = slave; - for (UInt i = 0; i < master.numNodes(); ++i) - conn[1 + i] = master.node(i); - - // evaluate shape functions at slave master coordinate - vector_type nu = master.normal(); - vector_type sh(master.numNodes()); - InterpolationElement< - TangentTraits::interpolation_type>::computeShapes(xi, sh); - - // compute vector N - vector_type N(dim * (master.numNodes() + 1)); - for (UInt i = 0; i < dim; ++i) { - N[i] = nu[i]; - for (UInt j = 0; j < master.numNodes(); ++j) - N[(1 + j) * dim + i] = -nu[i] * sh[j]; - } - - matrix_type dsh(dim - 1, master.numNodes()); - InterpolationElement::interpolation_type>::computeDNDS( - xi, dsh); - - // obtain contribution to stiffness matrix and force vector depending on - // the dimension - auto t = TangentTraits::computeTangentAndResidual( - model_, std::make_tuple(gap, s1, s2, s3), master, sh, dsh, N); - - matrix_type &kc = std::get<0>(t); - vector_type &fc = std::get<1>(t); - - Array &boundary = model_.getBlockedDOFs(); - - // assemble local components into global matrix and vector not taking into - // account fixed dofs - std::vector eq(conn.size() * dim); - std::vector fixed(conn.size() * dim, false); - for (UInt i = 0; i < conn.size(); ++i) - for (UInt j = 0; j < dim; ++j) { - eq.at(i *dim + j) = eqnum(conn[i] * dim + j); - fixed.at(i *dim + j) = boundary(conn[i], j); - } - - for (UInt i = 0; i < kc.rows(); ++i) { - // if dof is blocked, don't add terms - if (fixed.at(i)) - continue; - F[eq[i]] += fc(i); - for (UInt j = i; j < kc.columns(); ++j) { - K.addToProfile(eq[i], eq[j]); - K(eq[i], eq[j]) += kc(i, j); - } - } - - // terms corresponding to lagrangian multiplier contribution - size_t ii = original + kk; - - // assemble contribution to force vector - F[ii] = -gap; - - // assemble contribution to stiffness matrix (only upper-triangular) - for (UInt i = 0; i < N.size(); ++i) { - K.addToProfile(eq[i], ii); - K(eq[i], ii) -= N[i]; - } - } - - // increment multiplier counter - ++kk; - - // increase iterator - ++it; - } - - return true; -} - -template -std::ostream &operator<<( - std::ostream &os, - const ContactResolution &cr) { - - typedef typename ContactResolution< - Dim, _static, _augmented_lagrangian>::element_type element_type; - - os << "Augmented-Lagrangian resolution type. Parameters:" << endl; - if (cr[Automatic_penalty_parameter]) - cout << "\tpenalty = auto" << endl; - else - cout << "\tpenalty = " << cr[Epsilon] << endl; - - cout << "\talpha = " << cr[Alpha] << endl; - cout << "\tutol = " << cr[Multiplier_tol] << endl; - cout << "\tntol = " << cr[Newton_tol] << endl; - cout << "\tusteps = " << cr[Multiplier_max_steps] << endl; - cout << "\tnsteps = " << cr[Newton_max_steps] << endl; - cout << "\tverbose = " << cr[Verbose] << endl; - - cout << "\n Slave nodes: "; - for (auto it = cr.sm_.begin(); it != cr.sm_.end(); ++it) - os << it->first << " "; - os << endl; - - // loop over pairs - cout << "\n Slave master pairs" << endl; - for (auto it = cr.sm_.begin(); it != cr.sm_.end(); ++it) { - auto slave = it->first; - auto master = it->second; - os << "\tslave: " << slave << ", Master: "; - if (master == element_type()) - os << "none" << endl; - else - os << master << endl; - } - return os; -} - -template std::ostream &operator<<( - std::ostream &, - const ContactResolution<2, _static, _augmented_lagrangian> &); - -template std::ostream &operator<<( - std::ostream &, - const ContactResolution<3, _static, _augmented_lagrangian> &); - -template class ContactResolution<2, _static, _augmented_lagrangian>; -template class ContactResolution<3, _static, _augmented_lagrangian>; - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.hh b/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.hh deleted file mode 100644 index 3957937a6..000000000 --- a/extra_packages/contact_alejandro/src/contact/resolution/resolution_augmented_lagrangian.hh +++ /dev/null @@ -1,154 +0,0 @@ -/** - * @file resolution_augmented_lagrangian.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact resolution classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_RESOLUTION_AUGMENTED_LAGRANGIAN_HH__ -#define __AKANTU_RESOLUTION_AUGMENTED_LAGRANGIAN_HH__ - -#include - -#include "search.hh" -#include "aka_common.hh" -#include "contact_common.hh" -#include "aka_array.hh" -#include "dumpable_inline_impl.hh" -//#include "dumper_iohelper_tmpl.hh" -#include "solid_mechanics_model_element.hh" -#include "aka_optimize.hh" -#include "parsable.hh" - -#define __LOC__ \ - std::cout << "File " << __FILE__ << ", line " << __LINE__ << std::endl; - -__BEGIN_AKANTU__ - -template -class ContactResolution : public ContactParameters, - public Parsable { - typedef SolidMechanicsModel model_type; - typedef ModelElement element_type; - - typedef std::map slave_master_map; - typedef std::map real_map; - typedef typename real_map::iterator real_iterator; - typedef std::map gap_map; - - typedef Point point_type; - typedef array::Array<1, Real> vector_type; - typedef array::Array<2, Real> matrix_type; - - model_type &model_; - slave_master_map sm_; - real_map areas_, gaps_; - real_map multipliers_, penalty_; - size_t uiter_, niter_; - Array multiplier_dumper_, pressure_dumper_; - std::map contact_status_; - std::map status_change_; - -protected: - //! Initialize function that's called after the derived Contact's constructor - virtual void initialize(); - -public: - //! Parameter constructor - ContactResolution(model_type &m); - - //! Add slave - void addSlave(UInt s) { sm_[s] = element_type(); } - - //! Add slave-master pair - void addPair(UInt s, element_type el) { sm_[s] = el; } - - //! Add area to a slave node - void addArea(UInt n, Real a) { - if (a != 0.) - areas_[n] = a; - } - - //! Implementation of the contact step - template - void solveContactStep(SearchBase *sp) { - solveContactStepImpl(sp, Int2Type()); - } - - //! Get contact force (sum of Lagrange multipliers) - Real getForce() { - Real f = 0.; - for (auto v : multipliers_) - f += v.second; - return f; - } - - //! Get maximum value of contact pressure - Real getMaxPressure() { - Real p = 0.; - for (auto v : multipliers_) { - auto slave = v.first; - auto it = areas_.find(slave); - if (it != areas_.end()) - p = std::max(p, v.second / it->second); // max(p, lambda/area) - } - return p; - } - -private: - //! Compute penalty parameter values for each slave node automatically - void getPenaltyValues(); - - //! Add stiffness matrix and force vector contributions due to contact - bool computeTangentAndResidual(real_map &lambda_new, SearchBase *cp, - Real &error, Int2Type<_uzawa>); - bool computeTangentAndResidual(Array &solution, Array &rhs, - SearchBase *cp, Real &error, - Int2Type<_generalized_newton>); - - //! Implementation of the contact step using Uzawa's method - void solveContactStepImpl(SearchBase *sp, Int2Type<_uzawa>); - - //! Implementation of the contact step using Uzawa's method - void solveContactStepImpl(SearchBase *sp, Int2Type<_generalized_newton>); - -protected: - //! Dump of Paraview files including contact information - void dump(); - - //! Provide standard output of resolution object - template - friend std::ostream &operator<<( - std::ostream &os, - const ContactResolution &); -}; - -__END_AKANTU__ - -#endif /* __AKANTU_RESOLUTION_AUGMENTED_LAGRANGIAN_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/scheme.cc b/extra_packages/contact_alejandro/src/contact/scheme.cc deleted file mode 100644 index ab2a3ec1e..000000000 --- a/extra_packages/contact_alejandro/src/contact/scheme.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file scheme.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact scheme classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "scheme.hh" - -__BEGIN_AKANTU__ - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/scheme.hh b/extra_packages/contact_alejandro/src/contact/scheme.hh deleted file mode 100644 index 8bdee7b61..000000000 --- a/extra_packages/contact_alejandro/src/contact/scheme.hh +++ /dev/null @@ -1,48 +0,0 @@ -/** - * @file scheme.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact scheme classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_SCHEME_HH__ -#define __AKANTU_SCHEME_HH__ - -#include "aka_common.hh" -#include "contact_common.hh" -#include "discretization.hh" -#include "friction.hh" - -__BEGIN_AKANTU__ - - - - -__END_AKANTU__ - -#endif /* __AKANTU_SCHEME_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/search.cc b/extra_packages/contact_alejandro/src/contact/search.cc deleted file mode 100644 index bd873bee5..000000000 --- a/extra_packages/contact_alejandro/src/contact/search.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file search.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief global contact search - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "search.hh" - -__BEGIN_AKANTU__ - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/search.hh b/extra_packages/contact_alejandro/src/contact/search.hh deleted file mode 100644 index eb420bc52..000000000 --- a/extra_packages/contact_alejandro/src/contact/search.hh +++ /dev/null @@ -1,152 +0,0 @@ -/** - * @file search.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Apr 13 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief global contact search - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_SEARCH_HH__ -#define __AKANTU_SEARCH_HH__ - -#include - -#include "aka_common.hh" -#include "solid_mechanics_model.hh" -#include "aka_point.hh" -#include "aka_geometry.hh" - - -__BEGIN_AKANTU__ - - - -struct SearchBase { - template - SearchBase(model_type & model) { - } - - virtual int search(const Real *) { - static bool msg = false; - if (!msg) { - std::cout << " - Warning: calling default base searcher, type any key to continue." << std::endl; - std::cin.ignore(); - msg = true; - } - return -1; - } - - virtual ~SearchBase() - { - } - - //! Provide standard output of contact object - friend std::ostream& operator << (std::ostream & os, const SearchBase &cr) { - os << "Search base class (no search performed)" << std::endl; - return os; - } -}; - - -template -class SearchTraits; - -template -struct SearchTraits <3, model_type> { - typedef Point <3> point_type; - typedef ModelElement element_type; - - static bool check_projection(const point_type& p, model_type& model, UInt id) { - element_type m(model, _triangle_3, id); - - return point_has_projection_to_triangle(p, m.template point <3>(0), m.template point <3>(1), m.template point <3>(2)); - } -}; - - -template -struct SearchTraits <2, model_type> { - typedef Point <2> point_type; - typedef ModelElement element_type; - - static bool check_projection(const point_type& p, model_type& model, UInt id) { - element_type m(model, _segment_2, id); - - return has_projection(p, m.template point <2>(0), m.template point <2>(1)); - } -}; - - -template -struct MasterAssignator : public SearchBase { - typedef Point point_type; - typedef SolidMechanicsModel model_type; - - std::list surfaces_; - model_type &model_; - - MasterAssignator(model_type & m) : SearchBase(m), surfaces_(), model_(m) - { - } - - - virtual int search(const Real *ptr) { - point_type p(ptr); - - for (auto surface: surfaces_) { - ElementGroup &rs = model_.getMesh().getElementGroup(surface); - - for (ElementGroup::type_iterator tit = rs.firstType(); tit != rs.lastType(); ++tit) - for (ElementGroup::const_element_iterator it = rs.element_begin(*tit); - it != rs.element_end(*tit); ++it) - if (SearchTraits ::check_projection(p, model_, *it)) - return *it; - } - return -1; - } - - void searchSurface(const std::string& s) { - surfaces_.push_back(s); - } - - //! Provide standard output of contact object - friend std::ostream& operator << (std::ostream & os, const MasterAssignator &s) { - os << "MasterAssignator search class. Search surfaces: "; - - for (auto surface : s.surfaces_) - os << " " << surface; - os << std::endl; - return os; - } -}; - - - -__END_AKANTU__ - -#endif /* __AKANTU_SEARCH_HH__ */ diff --git a/extra_packages/contact_alejandro/src/contact/surface.cc b/extra_packages/contact_alejandro/src/contact/surface.cc deleted file mode 100644 index 06b75d82c..000000000 --- a/extra_packages/contact_alejandro/src/contact/surface.cc +++ /dev/null @@ -1,37 +0,0 @@ -/** - * @file surface.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact surface classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "surface.hh" - -__BEGIN_AKANTU__ - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/surface.hh b/extra_packages/contact_alejandro/src/contact/surface.hh deleted file mode 100644 index 2515bc15c..000000000 --- a/extra_packages/contact_alejandro/src/contact/surface.hh +++ /dev/null @@ -1,181 +0,0 @@ -/** - * @file surface.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact surface classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_CSURFACE_HH__ -#define __AKANTU_CSURFACE_HH__ - -#include - -#include "aka_common.hh" -#include "aka_bounding_box.hh" -#include "contact_common.hh" -#include "solid_mechanics_model.hh" - -__BEGIN_AKANTU__ - - -template -BoundingBox getBoundingBox(const Element& el, model_type& model) { - - typedef BoundingBox bbox_type; - typedef typename BoundingBox::point_type point_type; - - Mesh &mesh = model.getMesh(); - const Array &x = model.getCurrentPosition(); - - // for each element, construct the bounding box - bbox_type elem_bb = bbox_type(); - - UInt nb_nodes = mesh.getNbNodesPerElement(el.type); - const Array &conn = mesh.getConnectivity(el.type); - - for (UInt n = 0; n -class CSurface { - - struct Element_set_comparator { - bool operator()(const Element& el1, const Element& el2) const - { return el1.element < el2.element; } - }; - -public: - - // type definitions - - typedef BoundingBox bbox_type; - typedef typename bbox_type::point_type point_type; - typedef SolidMechanicsModel model_type; - typedef std::set element_container; - typedef typename element_container::const_iterator element_iterator; - - typedef std::set node_container; - typedef typename node_container::const_iterator node_iterator; - -private: - - element_container elements_; //!< Surface sides - node_container nodes_; //!< Surface nodes - bbox_type bbox_; //!< Bounding box - const model_type &model_; //!< Reference to model - -public: - - CSurface(const model_type &model) : elements_(), bbox_(), model_(model) {} - - CSurface& operator=(const CSurface& cs) { - - if (this != &cs) { - new (this) CSurface(cs); - } - return *this; - } - - void update_bounding_box() { - - bbox_ = bbox_type(); - const Array &x = model_.getCurrentPosition(); - - // loop over all nodes to find out bounding box - for (node_iterator it = nodes_.begin(); it != nodes_.end(); ++it) - bbox_ += point_type(&x(*it)); - } - - bbox_type const& bounding_box() const - { return bbox_; } - - //! Add an element to the surface - void add_element(ElementType type, UInt id) - { elements_.insert(Element(type, id)); } - - void add_node(UInt n) - { nodes_.insert(n); } - - //! Return the number of elements in the surface - UInt size() const - { return elements_.size(); } - - void intersects(const bbox_type& bb, std::set& intersected) const { - - // loop over elements - for (element_iterator it = elements_.begin(); it != elements_.end(); ++it) { - - // for each element, construct the bounding box - bbox_type elem_bb = getBoundingBox(*it, model_); - - // check for bounding box intersection - if (bb & elem_bb) - intersected.insert(&*it); - - } // loop over elements - } - - bool in_surface(UInt np, const Element* sp) const { - - element_iterator elit = elements_.find(*sp); - if (elit == elements_.end()) - return false; - - node_iterator nit = nodes_.find(np); - if (nit == nodes_.end()) - return false; - - return true; - } - - //! Enable std output - friend std::ostream& operator<<(std::ostream& os, const CSurface& s) { - - os<<" Contact surface: "<element; - os<<"\n "< - * - * @date creation: Mon Jul 09 2012 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact zone classes - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de - * Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des - * Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "zone.hh" - -__BEGIN_AKANTU__ - - - -__END_AKANTU__ diff --git a/extra_packages/contact_alejandro/src/contact/zone.hh b/extra_packages/contact_alejandro/src/contact/zone.hh deleted file mode 100644 index 52965c1f8..000000000 --- a/extra_packages/contact_alejandro/src/contact/zone.hh +++ /dev/null @@ -1,436 +0,0 @@ -/** - * @file zone.hh - * - * @author Alejandro M. Aragón - * - * @date creation: Fri Jan 04 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief contact zone classes - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - -#ifndef __AKANTU_CZONE_HH__ -#define __AKANTU_CZONE_HH__ - -#include - -#include "aka_common.hh" -#include "surface.hh" - -__BEGIN_AKANTU__ - - -//! This class represents a contact element surface -template -class CZone { - -public: - - typedef CSurface contact_surface; - typedef typename std::list surface_list; - typedef typename surface_list::const_iterator surface_iterator; - - typedef typename CSurface::point_type point_type; - typedef typename CSurface::bbox_type bbox_type; - -// typedef std::set node_set; - typedef std::unordered_set node_set; - typedef typename node_set::iterator node_iterator; - typedef typename node_set::const_iterator const_node_iterator; - typedef std::map bucket_container; - typedef typename bucket_container::iterator bucket_iterator; - typedef typename bucket_container::const_iterator const_bucket_iterator; - - typedef std::set element_container; - typedef typename element_container::const_iterator element_iterator; - // typedef std::map node_element_map; - // typedef typename node_element_map::iterator node_element_iterator; - - typedef std::map elementmap; - typedef typename elementmap::iterator elementmap_iterator; - typedef typename elementmap::const_iterator const_elementmap_iterator; - -private: - - SolidMechanicsModel& model_; - bbox_type bbox_; - Real delta_[d]; //!< grid size length - int size_[d]; //!< grid dimensions, number of buckets in each dimension - int index_[d]; //!< indexes to convert to 1D equivalent array - bucket_container buckets_; - elementmap elements_; - // node_element_map node_element_map_; - surface_list surfaces_; - -public: - - CZone() {} - - // clear memory - void clear() { - buckets_.clear(); - // node_element_map_.clear(); - } - - typename bucket_container::size_type buckets_size() const - { return buckets_.size(); } - - bucket_iterator buckets_begin() - { return buckets_.begin(); } - - bucket_iterator buckets_end() - { return buckets_.end(); } - - const_bucket_iterator buckets_begin() const - { return buckets_.begin(); } - - const_bucket_iterator buckets_end() const - { return buckets_.end(); } - - void erase_bucket(bucket_iterator bit) - { buckets_.erase(bit); } - - CZone(SolidMechanicsModel& model, - const bbox_type& bb, - const element_container& elems, - const contact_surface& s1, - const contact_surface& s2) - : model_(model), bbox_(bb), delta_(), size_(), index_() { - - assert(!elems.empty()); - - surfaces_.push_back(&s1); - surfaces_.push_back(&s2); - - // tolerance - Real epsilon = 2*std::numeric_limits::epsilon(); - - // loop over elements to get bucket increments - typedef typename element_container::const_iterator element_iterator; - for (element_iterator it = elems.begin(); it != elems.end(); ++it) { - - // get side bounding box - bbox_type bb = getBoundingBox(**it, model_); - - // process box to modify delta array - const point_type &m = bb.min(); - const point_type &M = bb.max(); - for (int i=0; i((M[i] - m[i]) / delta_[i])+1; - } - - // get indexes to convert multi-dimensional indexes to a 1D array - index_[0] = 1; - for (int i=1; i nodes_inside; - - Mesh &mesh = model.getMesh(); - const Array &x = model.getCurrentPosition(); - - // loop over elements - for (element_iterator it = elems.begin(); it != elems.end(); ++it) { - - UInt nb_nodes = mesh.getNbNodesPerElement((*it)->type); - const Array &conn = mesh.getConnectivity((*it)->type); - - // loop over nodes - for (UInt n = 0; nelement, n); - point_type node_coord = point_type(&x(node)); - - // if node is within bounding box - if (bbox_ & node_coord) { - - nodes_inside.insert(node); - - // compute index into one-dimensional array - int coord[d]; - for (int i=0; i((node_coord[i] - m[i])/delta_[i]); - int idx = compute_index(coord); - - // add node to bucket - buckets_[idx].insert(node); - - // // add side to map - // node_element_map_[node].insert(*it); - } // node within bounding box - } // loop over nodes - } // loop over elements - - // check nodes - std::set node_check; - for (bucket_iterator it = buckets_.begin(); it != buckets_.end(); ++it) - for (node_iterator nit = it->second.begin(); nit != it->second.end(); ++nit) - node_check.insert(*nit); - cout<<"*** INFO *** Node check after creating buckets passed: "<<(node_check.size() == nodes_inside.size())<) const { - array[0] = idx % index_[1]; - array[1] = idx / index_[1]; - } - - void decompute_index(int idx, int *array, Int2Type<3>) const { - array[0] = (idx % (index_[2])) % index_[1]; - array[1] = (idx % (index_[2])) / index_[1]; - array[2] = idx / index_[2]; - } - - - void add_elements(const element_container& s) { - - const point_type& bbm = bbox_.min(); - - // loop over elements - for (element_iterator it = s.begin(); it != s.end(); ++it) { - - bbox_type elbb = getBoundingBox(**it, model_); - const point_type& elmin = elbb.min(); - const point_type& elmax = elbb.max(); - - int min[d], max[d]; - for (int i=0; i((elmin[i] - bbm[i])/delta_[i])); - max[i] = std::min(size_[i], static_cast((elmax[i] - bbm[i])/delta_[i]) +1); - } - - add_element(*it, min, max, Int2Type()); - - } // loop over elements - } - - void add_element(const Element* el, int *min, int*max, Int2Type<2>) { - - for (int i=min[0]; i) { - - for (int i=min[0]; i()); - return elements; - } - - bool in_surface(UInt np, const Element* sp) { - - for (surface_iterator it = surfaces_.begin(); it != surfaces_.end(); ++it) { - - const contact_surface& s = **it; - if (s.in_surface(np, sp)) - return true; - } - return false; - } - - bool in_element(UInt np, const Element* sp) { - - // loop over nodes of side - Mesh& mesh = model_.getMesh(); - UInt nb_nodes = mesh.getNbNodesPerElement(sp->type); - const Array &conn = mesh.getConnectivity(sp->type); - - // loop over nodes - for (UInt n = 0; nelement, n); - if (node == np) - return true; - } - return false; - } - - void set_union(int bucket, element_container& elements) const { - - // check if bucket exists - const_elementmap_iterator it = elements_.find(bucket); - - // if bucket is not found, return since there are no elements to add - if (it == elements_.end()) - return; - - // otherwise add elements - for (element_iterator sit = it->second.begin(); sit != it->second.end(); ++sit) - elements.insert(*sit); - } - - - - template - void collect(container_type &c, int idx, Int2Type<2>) const { - - const int &m = size_[0]; - const int &n = size_[1]; - - int coord[d]; - decompute_index(idx, coord, Int2Type<2>()); - - for (int i=coord[0]-1; i<=coord[0]+1; ++i) - if (i >=0 && i=0 && j - void collect(container_type &c, int idx, Int2Type<3>) const { - - const int &m = size_[0]; - const int &n = size_[1]; - const int &p = size_[2]; - - int coord[d]; - decompute_index(idx, coord, Int2Type<3>()); - - for (int i=coord[0]-1; i<=coord[0]+1; ++i) - if (i >=0 && i=0 && j=0 && k &x = cz.model_.getCurrentPosition(); - - int coord[d]; - - os<<" Contact zone: "< nodes; - for (const_bucket_iterator it = cz.buckets_.begin(); it != cz.buckets_.end(); ++it) { - os<<" node bucket "<first; - - cz.decompute_index(it->first, coord, Int2Type()); - os<<" ("<second.size()<<" nodes:"; - - for (const_node_iterator nit = it->second.begin(); nit != it->second.end(); ++nit) { - os<<" "<<*nit<<" ("<first; - - - cz.decompute_index(it->first, coord, Int2Type()); - os<<" ("<second.size()<<" elements:"<second.begin(); sit != it->second.end(); ++sit) { - os<<"\t\t"<<**sit; - - UInt nb_nodes = mesh.getNbNodesPerElement((*sit)->type); - const Array &conn = mesh.getConnectivity((*sit)->type); - - os<<", nodes:"; - - // loop over nodes - for (UInt n = 0; nelement, n)<<" ("<< - point_type(&x(conn((*sit)->element, n)))<<")"; - os< - * @author Nicolas Richart - * - * @date creation: Tue May 07 2013 - * @date last modification: Sun Oct 19 2014 - * - * @brief elements for solid mechanics models - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -/* -------------------------------------------------------------------------- */ - - -#ifndef AKANTU_SOLID_MECHANICS_MODEL_ELEMENT_HH -#define AKANTU_SOLID_MECHANICS_MODEL_ELEMENT_HH - -#include - -#include "mesh.hh" -#include "aka_error.hh" -#include "solid_mechanics_model.hh" -#include "aka_bounding_box.hh" - - -__BEGIN_AKANTU__ - - -typedef array::vector_type vector_type; -typedef array::matrix_type matrix_type; - - - - -template <> -class ModelElement : public Element { - -public: - - - typedef Element element_base; - - SolidMechanicsModel *model_; //!< Reference to model - UInt *connectivity_; //!< Ponter to connectivity array - - - typedef SolidMechanicsModel model_type; - - ModelElement() : element_base(), model_(nullptr), connectivity_() {} - - ModelElement(SolidMechanicsModel& m, Element &el) - : element_base(el), model_(&m) { - connectivity_ = &m.getMesh().getConnectivity(this->type, this->ghost_type)(this->element); - } - - ModelElement(SolidMechanicsModel& m, ElementType type, UInt id, GhostType gt = _not_ghost) - : element_base(type, id, gt), model_(&m) { - connectivity_ = &m.getMesh().getConnectivity(type, gt)(id); - } - - ModelElement(const ModelElement& p) : element_base(static_cast(p)), model_(p.model_), connectivity_(p.connectivity_) {} - - - model_type& model() { return *model_; } - - UInt numNodes() const - { return Mesh::getNbNodesPerElement(type); } - - template - bool shareNodes(element_type& el) { - - for (UInt i=0; i - UInt shareNode(element_type& el) { - - for (UInt i=0; i coordinates() { - - UInt nb_nodes = Mesh::getNbNodesPerElement(this->type); - const Array &position = model_->getCurrentPosition(); - std::vector coord(nb_nodes); - for (size_t i=0; itype); - const Array &position = model_->getCurrentPosition(); - vector_type sum(model_->getSpatialDimension()); - for (size_t i=0; i(&position(connectivity_[i])); - sum += vector_type(model_->getSpatialDimension(), p); - } - - return (1./static_cast(nb_nodes)) * sum; - } - - //! Returns the closest point to an element and the element normal - vector_type normal() { - - vector_type n; - auto coord = coordinates(); - - switch (type) { - case _segment_2: - { - // create points from segment - Point<2> x(coord[0]); - Point<2> y(coord[1]); - Point<2> t = y-x; - n = vector_type(2); - // normal2 normalizes the normal so that its magnitude is 1 - Math::normal2(&t[0], &n[0]); - - break; - } - case _triangle_3: - { - Point<3> x(coord[0]); - Point<3> y(coord[1]); - Point<3> z(coord[2]); - Point<3> t1 = y-x; - Point<3> t2 = z-x; - n = vector_type(3); - Math::vectorProduct3(&t1[0], &t2[0], &n[0]); - Math::normalize3(&n[0]); - - break; - } - default: - AKANTU_DEBUG_ERROR("No element type found"); - } - return n; - } - - - - template - BoundingBox boundingBox() { - - typedef typename BoundingBox::point_type point_type; - - assert(dim == model_->getSpatialDimension()); - BoundingBox bb; - UInt nb_nodes = Mesh::getNbNodesPerElement(this->type); - const Array &position = model_->getCurrentPosition(); - for (size_t i=0; i - Point point(UInt nid) { - - AKANTU_DEBUG_ASSERT(dim == model_->getSpatialDimension(), - "Point and model dimensions do not match"); - UInt n = node(nid); - const Array &position = model_->getCurrentPosition(); - Real * p = const_cast(&position(n)); - return Point(p); - } - - - // mass - vector_type getMass(UInt nid) { - UInt n = node(nid); - Array &mass = model_->getMass(); - return vector_type(model_->getSpatialDimension(), &mass(n)); - } - - // mass for const objects - const vector_type getMass(UInt nid) const { - UInt n = node(nid); - Array &mass = model_->getMass(); - return vector_type(model_->getSpatialDimension(), &mass(n)); - } - - // initial coordinates - vector_type getInitialCoordinates(UInt nid) { - UInt n = node(nid); - Array &coord = model_->getMesh().getNodes(); - return vector_type(model_->getSpatialDimension(), &coord(n)); - } - - const vector_type getInitialCoordinates(UInt nid) const { - UInt n = node(nid); - Array &coord = model_->getMesh().getNodes(); - return vector_type(model_->getSpatialDimension(), &coord(n)); - } - - - // displacement - vector_type getDisplacement(UInt nid) { - UInt n = node(nid); - Array &displacement = model_->getDisplacement(); - return vector_type(model_->getSpatialDimension(), &displacement(n)); - } - - // displacement for const objects - const vector_type getDisplacement(UInt nid) const { - UInt n = node(nid); - Array &displacement = model_->getDisplacement(); - return vector_type(model_->getSpatialDimension(), &displacement(n)); - } - - // velocity - vector_type getVelocity(UInt nid) { - UInt n = node(nid); - Array &velocity = model_->getVelocity(); - return vector_type(model_->getSpatialDimension(), &velocity(n)); - } - - // velocity for const objects - const vector_type getVelocity(UInt nid) const { - UInt n = node(nid); - Array &velocity = model_->getVelocity(); - return vector_type(model_->getSpatialDimension(), &velocity(n)); - } - - // acceleration - vector_type getAcceleration(UInt nid) { - UInt n = node(nid); - Array &acceleration = model_->getAcceleration(); - return vector_type(model_->getSpatialDimension(), &acceleration(n)); - } - - // acceleration for const objects - const vector_type getAcceleration(UInt nid) const { - UInt n = node(nid); - Array &acceleration = model_->getAcceleration(); - return vector_type(model_->getSpatialDimension(), &acceleration(n)); - } - - // position (location + displacement) - vector_type getCurrentPosition(UInt nid) { - UInt n = node(nid); - const Array &position = model_->getCurrentPosition(); - Real * p = const_cast(&position(n)); - return vector_type(model_->getSpatialDimension(), p); - } - - // position (location + displacement) for const objects - const vector_type getCurrentPosition(UInt nid) const { - UInt n = node(nid); - const Array &position = model_->getCurrentPosition(); - Real * p = const_cast(&position(n)); - return vector_type(model_->getSpatialDimension(), p); - } - - // residual - vector_type getResidual(UInt nid) { - UInt n = node(nid); - const Array & residual = model_->getResidual(); - Real * p = const_cast(&residual(n)); - return vector_type(model_->getSpatialDimension(), p); - } - - // residual for const objects - const vector_type getResidual(UInt nid) const { - UInt n = node(nid); - const Array & residual = model_->getResidual(); - Real * p = const_cast(&residual(n)); - return vector_type(model_->getSpatialDimension(), p); - } - - // momentum - vector_type getMomentum(UInt nid) { - UInt n = node(nid); - Array &velocity = model_->getVelocity(); - Array &mass = model_->getMass(); - vector_type p(model_->getSpatialDimension()); - for (size_t i=0; i(*this).getMomentum(nid); - } - -}; - - -//! Returns the closest point to an element and the element normal -template -std::pair closest_point_to_element(const point_type& p, element_type& el) { - - point_type r; - vector_type n; - - switch (el.type) { - case _segment_2: - { - // create points from segment - auto coord = el.coordinates(); - assert (coord.size() == 2); - point_type x(coord[0]); - point_type y(coord[1]); - - r = closest_point_to_segment(p, x, y); - - point_type t = y-x; - n = vector_type(2); - Math::normal2(&t[0], &n[0]); - - break; - } - - default: - AKANTU_DEBUG_ERROR("No element type found"); - } - - return std::make_pair(r, n); -} - - - - - -template -bool balance(Real Dt, int id, const pair_type& r, ModelElement& sel, ModelElement& mel) { - - -// constexpr int dim = point_type::dim(); - - // treat first element as slave - auto coord = sel.coordinates(); - - // create point - point_type p(coord[id]); - - // else find closest distance from p to contacting element c2 - // std::pair r = closest_point_to_element(p, mel); - const point_type& q = r.first; - const vector_type& n = r.second; - - // get distance from current position - Real delta = sqrt((q-p).sq_norm()); - - auto mass = sel.getMass(id)[0]; - - // compute force at slave node - vector_type N = 2 * delta * mass / pow(Dt,2.) * n; - - // update residual and velocity for slave - vector_type sr = sel.getResidual(id); - vector_type m = sel.getMass(id); - vector_type v = sel.getVelocity(id); - vector_type a = sel.getAcceleration(id); - for (size_t i=0; i -std::pair commonPonit(const element_container& els) { - - typedef std::pair pair_type; - - // balance with slave forces - switch (els.size()) { - case 2: - { - - auto it = els.begin(); - auto el1 = *it++; - auto el2 = *it; - - // get normals - auto n1 = el1.normal(); - auto n2 = el2.normal(); - - // average normal - vector_type n = n1 + n2; - n *= (1/n.norm()); - - // get common point - assert(el1.shareNodes(el2)); - - UInt c = el1.shareNode(el2); - - assert(el1.shareNode(el2) == el2.shareNode(el1)); - - // set location of slave node - Array &displacement = el1.model().getDisplacement(); - Array &coord = el1.model().getMesh().getNodes(); - - point_type p; - for (int i=0; i -bool penetrates(point_type& r, element_type& el) { - - // balance with slave forces - switch (el.type) { - case _segment_2: - { - - // create points from master - auto coord = el.coordinates(); - assert (coord.size() == 2); - point_type p(coord[0]); - point_type q(coord[1]); - - return left_turn(p,q,r) > 0 && has_projection(r, p, q); - break; - } - - default: - AKANTU_DEBUG_ERROR("No element type found"); - } - - // should never get here - assert(false); - return false; -} - -__END_AKANTU__ - - -#endif /* AKANTU_SOLID_MECHANICS_MODEL_ELEMENT_HH */ diff --git a/extra_packages/contact_alejandro/test/CMakeLists.txt b/extra_packages/contact_alejandro/test/CMakeLists.txt deleted file mode 100644 index 41c441da0..000000000 --- a/extra_packages/contact_alejandro/test/CMakeLists.txt +++ /dev/null @@ -1,124 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Alejandro M. Aragón -# -# @date creation: Mon Nov 21 2011 -# @date last modification: Mon Dec 07 2015 -# -# @brief configuration file for contact tests -# -# @section LICENSE -# -# Copyright (©) 2010-2012, 2014, 2015 EPFL (Ecole Polytechnique Fédérale de -# Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des -# Solides) -# -# Akantu 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. -# -# Akantu 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 Akantu. If not, see . -# -# @section DESCRIPTION -# -#=============================================================================== - -add_mesh(hertz_2D_mesh_test hertz_2D.geo 2 1) - -register_test(test_hertz_2D - SOURCES hertz_2D.cc - DEPENDS hertz_2D_mesh_test - FILES_TO_COPY steel.dat - PACKAGE contact - ) - -#add_mesh(hertz_3D_mesh_test hertz_3D.geo 3 1) -register_test(test_hertz_3D - SOURCES hertz_3D.cc - FILES_TO_COPY steel.dat hertz_3D.msh - PACKAGE contact - ) - -add_mesh(offset_1slave_mesh offset_1slave.geo 2 1) - -register_test(test_offset_1slave - SOURCES offset_1slave.cc - DEPENDS offset_1slave_mesh - FILES_TO_COPY steel.dat - PACKAGE contact - ) - -add_mesh(offset_2slaves_mesh offset_2slaves.geo 2 1) - -register_test(test_offset_2slaves - SOURCES offset_2slaves.cc - DEPENDS offset_2slaves_mesh - FILES_TO_COPY steel.dat - PACKAGE contact - ) - -#=============================================================================== -# Alain Curnier suggested tests - -add_mesh(acurnier_2D_1_mesh acurnier_2D_1.geo 2 1) - -register_test(test_acurnier_2D_1 - SOURCES acurnier_2D_1.cc - DEPENDS acurnier_2D_1_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) - -add_mesh(acurnier_2D_2_mesh acurnier_2D_2.geo 2 1) - -register_test(test_acurnier_2D_2 - SOURCES acurnier_2D_2.cc - DEPENDS acurnier_2D_2_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) - -add_mesh(acurnier_2D_3_mesh acurnier_2D_3.geo 2 1) - -register_test(test_acurnier_2D_3 - SOURCES acurnier_2D_3.cc - DEPENDS acurnier_2D_3_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) - - -add_mesh(acurnier_3D_1_mesh acurnier_3D_1.geo 3 1) - -register_test(test_acurnier_3D_1 - SOURCES acurnier_3D_1.cc - DEPENDS acurnier_3D_1_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) - -add_mesh(acurnier_3D_2_mesh acurnier_3D_2.geo 3 1) - -register_test(test_acurnier_3D_2 - SOURCES acurnier_3D_2.cc - DEPENDS acurnier_3D_2_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) - -add_mesh(acurnier_3D_3_mesh acurnier_3D_3.geo 3 1) - -register_test(test_acurnier_3D_3 - SOURCES acurnier_3D_3.cc - DEPENDS acurnier_3D_3_mesh - FILES_TO_COPY material.dat - PACKAGE contact - ) diff --git a/extra_packages/contact_alejandro/test/acurnier_2D_1.cc b/extra_packages/contact_alejandro/test/acurnier_2D_1.cc deleted file mode 100644 index cfbaf69ef..000000000 --- a/extra_packages/contact_alejandro/test/acurnier_2D_1.cc +++ /dev/null @@ -1,107 +0,0 @@ -/** - * @file acurnier_2D_1.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the first simple test suggested by Alain Curnier - * for the verification of the implicit contact implementation of the Augmented - * lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_2D_1.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", model); - model.setMaterialSelector(material_selector); - - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addArea(4, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the first simple test suggested by Alain Curnier - * for the verification of the implicit contact implementation of the Augmented - * lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_2D_2.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", model); - model.setMaterialSelector(material_selector); - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); -// model.addDumpField("element_index_by_material"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addSlave(7); - cd.addArea(4, 1.0); - cd.addArea(7, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the third simple test suggested by Alain Curnier - * for the verification of the implicit contact implementation of the Augmented - * lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_2D_3.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", - model); - model.setMaterialSelector(material_selector); - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addSlave(7); - cd.addSlave(9); - cd.addArea(4, 1.0); - cd.addArea(7, 1.0); - cd.addArea(9, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout << "Force: " << cd.getForce() << endl; - - // finalize simulation - finalize(); - return EXIT_SUCCESS; -} - diff --git a/extra_packages/contact_alejandro/test/acurnier_2D_3.geo b/extra_packages/contact_alejandro/test/acurnier_2D_3.geo deleted file mode 100644 index e10ef71ed..000000000 --- a/extra_packages/contact_alejandro/test/acurnier_2D_3.geo +++ /dev/null @@ -1,42 +0,0 @@ -cl1 = 2; -cl2 = -0.15; -cl3 = -0.5; -Point(1) = {-1., cl3, 0, cl1}; -Point(2) = {-1., 0.5, 0, cl1}; -Point(3) = {1., 0.5, 0, cl1}; -Point(4) = {1., cl3, 0, cl1}; -Point(5) = {0.7, 0.7+cl2, 0, cl1}; -Point(6) = {0.7, 1.4+cl2, 0, cl1}; -Point(7) = {0, 1.4+cl2, 0, cl1}; -Point(8) = {0, 0.7+cl2, 0, cl1}; -Point(9) = {-0.7, 1.4+cl2, 0, cl1}; -Point(10) = {-0.7, 0.7+cl2, 0, cl1}; -Line(1) = {1, 4}; -Line(2) = {4, 3}; -Line(3) = {3, 2}; -Line(4) = {2, 1}; -Line(5) = {8, 5}; -Line(6) = {5, 6}; -Line(7) = {6, 8}; -Line(8) = {7, 8}; -Line(9) = {6, 7}; -Line(10) = {10, 8}; -Line(11) = {8, 9}; -Line(12) = {7, 9}; -Line(13) = {9, 10}; -Line Loop(10) = {5, 6, 7}; -Plane Surface(11) = {10}; -Line Loop(12) = {-7, 9, 8}; -Plane Surface(13) = {12}; -Line Loop(14) = {1, 2, 3, 4}; -Plane Surface(15) = {14}; -Line Loop(16) = {10, 11, 13}; -Plane Surface(17) = {16}; -Line Loop(18) = {-8, 12, -11}; -Plane Surface(19) = {18}; -Physical Line("Contact") = {3}; -Physical Line("Top") = {9, 12}; -Physical Line("Bottom") = {1}; -Physical Surface("Top_body") = {11, 13, 17, 19}; -Physical Surface("Bottom_body") = {15}; - diff --git a/extra_packages/contact_alejandro/test/acurnier_3D_1.cc b/extra_packages/contact_alejandro/test/acurnier_3D_1.cc deleted file mode 100644 index e90d6745f..000000000 --- a/extra_packages/contact_alejandro/test/acurnier_3D_1.cc +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file acurnier_3D_1.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the fourth simple test suggested by Alain - * Curnier for the verification of the implicit contact implementation of the - * Augmented lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_3D_1.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", model); - model.setMaterialSelector(material_selector); - - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addArea(4, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the fifth simple test suggested by Alain - * Curnier for the verification of the implicit contact implementation of the - * Augmented lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_3D_2.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", model); - model.setMaterialSelector(material_selector); - - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(5); - cd.addSlave(6); - cd.addSlave(11); - cd.addArea(5, 1.0); - cd.addArea(6, 1.0); - cd.addArea(11, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file implements the sixth simple test suggested by Alain - * Curnier for the verification of the implicit contact implementation of the - * Augmented lagrangian formulation - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 3; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("material.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("acurnier_3D_3.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - MeshDataMaterialSelector material_selector("physical_names", model); - model.setMaterialSelector(material_selector); - - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addSlave(5); - cd.addSlave(6); - cd.addSlave(7); - cd.addSlave(20); - cd.addArea(4, 1.0); - cd.addArea(5, 1.0); - cd.addArea(6, 1.0); - cd.addArea(7, 1.0); - cd.addArea(20, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Top"); - - // fix entire contact body - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _z), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Tue May 13 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file tests for the Hertz solution in 2D - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" -#include "dumpable_inline_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef Point point_type; - typedef BoundingBox bbox_type; - typedef SolidMechanicsModel model_type; - typedef ModelElement master_type; - - typedef Contact > - contact_type; - - initialize("steel.dat", argc, argv); - - // create mesh - Mesh mesh(dim); - - // read mesh - mesh.read("hertz_2D.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // optimal value of penalty multiplier - cd[Alpha] = 0.4; - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // use bounding box to minimize slave-master pairs - Real r0 = 0.5; - Real r1 = 0.15; - point_type c1(-r0/2,-r1/2); - point_type c2( r0/2, r1/2); - bbox_type bb(c1, c2); - - // get physical names from mesh - Array &coords = mesh.getNodes(); - mesh.createGroupsFromMeshData("physical_names"); - - // compute areas for slave nodes that are used for the computation of contact pressures - model.applyBC(BC::Neumann::FromHigherDim(Matrix::eye(2,1.)), "contact_surface"); - // NOTE: the areas are computed by assigning a unit pressure to the contact surface, - // then the magnitude of the resulting force vector at nodes gives its associated area - Array& areas = model.getForce(); - - // add slave-master pairs and store slave node areas - ElementGroup &eg = mesh.getElementGroup("contact_surface"); - ElementGroup &rs = mesh.getElementGroup("rigid"); - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - - // get point of slave node - point_type n(&coords(*nit)); - - // process only if within bounding box - if (bb & n) { - - // loop over element types - for (ElementGroup::type_iterator tit = rs.firstType(); tit != rs.lastType(); ++tit) - - // loop over elements of the rigid surface - for (ElementGroup::const_element_iterator it = rs.element_begin(*tit); - it != rs.element_end(*tit); ++it) { - - // create master element - master_type m(model, _segment_2, *it); - assert(has_projection(n,m.point<2>(0),m.point<2>(1))); - - // add slave-master pair - cd.addPair(*nit,m); - } - - // compute and add area to slave node - Real a = 0.; - for (UInt i=0; i(cd); - - data[0][k] = delta; - data[1][k] = cd.getForce(); - data[2][k] = cd.getMaxPressure(); - ++k; - } - - // print results - size_t w = 10; - cout< - * - * @date creation: Tue May 13 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file tests for the Hertz solution in 3D - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" -#include "dumpable_inline_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - - -int main(int argc, char *argv[]) { - // set dimension - static const UInt dim = 3; - - // type definitions - typedef Point point_type; - typedef BoundingBox bbox_type; - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("steel.dat", argc, argv); - - // create mesh - Mesh mesh(dim); - - // read mesh - mesh.read("hertz_3D.msh"); - - // create model - model_type model(mesh); - SolidMechanicsModelOptions opt(_static); - - // initialize material - model.initFull(opt); - - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // optimal value of penalty multiplier - cd[Alpha] = 0.125; - cd[Multiplier_tol] = 1.e-2; - cd[Newton_tol] = 1.e-2; - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - // call update current position to be able to call later - // the function to get current positions - model.updateCurrentPosition(); - - - // get physical names from Gmsh file - mesh.createGroupsFromMeshData ("physical_names"); - - // set-up bounding box to include slave nodes that lie inside it - Real l1 = 1.; - Real l2 = 0.2; - Real l3 = 1.; - point_type c1(-l1 / 2, -l2 / 2, -l3 / 2); - point_type c2(l1 / 2, l2 / 2, l3 / 2); - bbox_type bb(c1, c2); - // get areas for the nodes of the circle - // this is done by applying a unit pressure to the contact surface elements - model.applyBC(BC::Neumann::FromHigherDim(Matrix ::eye(3, 1.)), "contact_surface"); - Array & areas = model.getForce(); - - // loop over contact surface nodes and store node areas - ElementGroup &eg = mesh.getElementGroup("contact_surface"); - Array &coords = mesh.getNodes(); - - cout << "- Adding areas to slave nodes. " << endl; - for (auto nit = eg.node_begin(); nit != eg.node_end(); ++nit) { - point_type p(&coords(*nit)); - - // ignore slave node if it doesn't lie within the bounding box - if (!(bb & p)) - continue; - - cd.addSlave(*nit); - // compute area contributing to the slave node - Real a = 0.; - for (UInt i = 0; i < dim; ++i) - a += pow(areas(*nit, i), 2.); - cd.addArea(*nit, sqrt(a)); - } - - // set force value to zero - areas.clear(); - - // output contact data info - cout<(cd); - - data[0][k] = delta; - data[1][k] = cd.getForce(); - data[2][k] = cd.getMaxPressure(); - ++k; - } - - // print results - size_t w = 14; - cout << setprecision(4); - cout << endl << setw(w) << "Disp." << setw(w) << "Force" << setw(w) << "Max pressure" << endl; - for (size_t i = 0; i < steps; ++i) - cout << setw(w) << data[0][i] << setw(w) << data[1][i] << setw(w) << data[2][i] << endl; - - // finalize simulation - finalize(); - return EXIT_SUCCESS; -} diff --git a/extra_packages/contact_alejandro/test/hertz_3D.msh b/extra_packages/contact_alejandro/test/hertz_3D.msh deleted file mode 100644 index f6016cdc7..000000000 --- a/extra_packages/contact_alejandro/test/hertz_3D.msh +++ /dev/null @@ -1,1390 +0,0 @@ -$MeshFormat -2.2 0 8 -$EndMeshFormat -$PhysicalNames -5 -2 1 "top_surface" -2 2 "rigid_surface" -2 5 "contact_surface" -3 3 "top_body" -3 4 "bottom_body" -$EndPhysicalNames -$Nodes -255 -1 0 0.001000000000000001 0 -2 0.5 0.501 0 -3 -0.5 0.501 0 -4 0 0.501 -0.5 -5 0 0.501 0.5 -6 0.5 0 0 -7 -0.5 0 0 -8 0 0 -0.5 -9 0 0 0.5 -10 0 -0.4 0.5 -11 0.5 -0.4 0 -12 0 -0.4 -0.5 -13 -0.5 -0.4 0 -14 -0.4730796551792242 0.3391493285293314 0 -15 -0.4135075340975027 0.2199101224792991 0 -16 -0.3433344173611988 0.1375148175575157 0 -17 -0.2744210546535532 0.08303698158469625 0 -18 -0.2121938879102612 0.04825972795262901 0 -19 -0.1584897754141341 0.02678381397386137 0 -20 -0.1133366829850978 0.01401458308288589 0 -21 -0.07595969997654682 0.006803557297836271 0 -22 -0.04530856472185216 0.003057097688052457 0 -23 -0.02031411946831165 0.001412833881586639 0 -24 0.02031411946826269 0.001412833881584641 0 -25 0.04530856472172527 0.003057097688040911 0 -26 0.07595969997632691 0.006803557297802465 0 -27 0.1133366829847357 0.01401458308280162 0 -28 0.1584897754135451 0.02678381397366447 0 -29 0.212193887909383 0.04825972795221739 0 -30 0.2744210546523341 0.08303698158389583 0 -31 0.3433344173596708 0.1375148175560723 0 -32 0.4135075340964653 0.219910122477773 0 -33 0.4730796551788679 0.3391493285282898 0 -34 0 0.3391493285293314 0.4730796551792242 -35 0 0.2199101224792991 0.4135075340975027 -36 0 0.1375148175575157 0.3433344173611988 -37 0 0.08303698158469625 0.2744210546535532 -38 0 0.04825972795262901 0.2121938879102612 -39 0 0.02678381397386137 0.1584897754141341 -40 0 0.01401458308288589 0.1133366829850978 -41 0 0.006803557297836271 0.07595969997654682 -42 0 0.003057097688052457 0.04530856472185216 -43 0 0.001412833881586639 0.02031411946831165 -44 0 0.001412833881584641 -0.02031411946826269 -45 0 0.003057097688040911 -0.04530856472172527 -46 0 0.006803557297802465 -0.07595969997632691 -47 0 0.01401458308280162 -0.1133366829847357 -48 0 0.02678381397366447 -0.1584897754135451 -49 0 0.04825972795221739 -0.212193887909383 -50 0 0.08303698158389583 -0.2744210546523341 -51 0 0.1375148175560723 -0.3433344173596708 -52 0 0.219910122477773 -0.4135075340964653 -53 0 0.3391493285282898 -0.4730796551788679 -54 -0.4619397662558402 0.501 0.1913417161820697 -55 -0.3535533905939495 0.501 0.353553390592598 -56 -0.1913417161829417 0.501 0.461939766255479 -57 0.1913417161820697 0.501 0.4619397662558402 -58 0.353553390592598 0.501 0.3535533905939495 -59 0.461939766255479 0.501 0.1913417161829417 -60 0.4619397662558402 0.501 -0.1913417161820697 -61 0.3535533905939495 0.501 -0.353553390592598 -62 0.1913417161829417 0.501 -0.461939766255479 -63 -0.1913417161820697 0.501 -0.4619397662558402 -64 -0.353553390592598 0.501 -0.3535533905939495 -65 -0.461939766255479 0.501 -0.1913417161829417 -66 -0.3535533905939495 0 0.353553390592598 -67 0.353553390592598 0 0.3535533905939495 -68 0.3535533905939495 0 -0.353553390592598 -69 -0.353553390592598 0 -0.3535533905939495 -70 0.353553390592598 -0.4 0.3535533905939495 -71 0.3535533905939495 -0.4 -0.353553390592598 -72 -0.353553390592598 -0.4 -0.3535533905939495 -73 -0.3535533905939495 -0.4 0.353553390592598 -74 0.2165895618827998 0.06304866863627323 0.1062430846698083 -75 0.08507612113069998 0.0223838080273715 0.1169982666323503 -76 0.0846496262749751 0.01073916017282484 0.04978704353001893 -77 0.435265769256691 0.3283326324163895 0.175298859908236 -78 0.02173485398373546 0.002247690878807052 0.02781600741630191 -79 0.142473318791986 0.05013353132222681 0.1625447041722115 -80 0.2985939223752105 0.114770018032847 0.108018843496121 -81 0.2144708024194287 0.1055379000491655 0.2182017470416827 -82 0.3276664822504659 0.212628598944634 0.2438782718139735 -83 0.06493565406722934 0.03665849747010214 0.1736960847547749 -84 0.3930792848983679 0.2096583370949671 0.1029985982405483 -85 0.218004800845571 0.2054225722847053 0.3392755385133044 -86 0.05041052466017076 0.004917714927704875 0.03689370462472565 -87 0.03972712688834505 0.009537065674900647 0.08298156164932304 -88 0.03310469885666096 0.01785529780762651 0.124399661000553 -89 0.09941879446251915 0.06565090839625876 0.2249156992017602 -90 0.1471792920422236 0.02743973011055395 0.0638664761528681 -91 0.3241323405583345 0.3676838435152894 0.3566020586372434 -92 0.02250560223639071 0.004431491246393304 0.05397419737426968 -93 0.2524847100343562 0.0728797949699565 0.05444778456375094 -94 0.127754499309493 0.3226606072892193 0.4493037379253935 -95 0.4830665977541143 0.4141165073472678 0.09538302175296909 -96 0.1051649012996272 0.1909898993411952 0.3779339638404537 -97 0.1109313791979213 0.1205736235044582 0.3049098246625045 -98 0.07943790904334799 0.01331155022808822 -0.07648264225227989 -99 0.0583776521460639 0.005047450098916662 -0.02496233115168833 -100 0.1753803791094287 0.3283743344530903 -0.4352494712436991 -101 0.02665149278251632 0.002306374904515129 -0.02437962718310969 -102 0.1598404770656313 0.05054565865026095 -0.1467716193635684 -103 0.121149297385937 0.1137010990910994 -0.2920999984554115 -104 0.2279890976830623 0.111064948085316 -0.2144099499229356 -105 0.244160192363017 0.2127582935383042 -0.3275706322631871 -106 0.1934843105317411 0.04480564886414079 -0.06671233446514353 -107 0.1030044314052508 0.2096640013795568 -0.3930819545828962 -108 0.3513190686707289 0.2152035012110137 -0.2118850472975584 -109 0.0509144780257505 0.006344858867574577 -0.05219202313213744 -110 0.08829164278504546 0.01005906077221003 -0.03437411823528548 -111 0.235555599243274 0.07645386245321412 -0.1194744188487546 -112 0.08945771689221538 0.02714909775985408 -0.1321462800635411 -113 0.1277721006368913 0.02199906977998684 -0.06505689161955271 -114 0.3570264334538266 0.3679409264307405 -0.3237706113224776 -115 0.03765283241446835 0.01561902179781272 -0.1139630212422248 -116 0.09540358124300211 0.4141274653617582 -0.4830645085405648 -117 0.4503344982968038 0.3259921914102403 -0.128728810203373 -118 0.08169438220288008 0.05585563909499192 -0.2125382927167752 -119 0.150084641871484 0.07765329778001479 -0.2196637657734464 -120 0.04228884034430652 0.03174559991136355 -0.1673677447412961 -121 0.3054291477580638 0.1197251521265316 -0.1065012961369314 -122 0.3832532333870211 0.1938327003388854 -0.09362269552460328 -123 0.2462961650705099 0.06994080458893132 -0.05938155541177966 -124 -0.2110519866857369 0.06418122806651344 -0.1210223921533704 -125 -0.08266448192845306 0.02294188860808999 -0.1209422405940145 -126 -0.08927354817570843 0.01458704592141646 -0.07370665981215827 -127 -0.4352363344237281 0.3283232494088527 -0.1753626898820825 -128 -0.140256197961748 0.05136640413852644 -0.1678029451648452 -129 -0.2980095084395045 0.1152031909362835 -0.1111357503051973 -130 -0.2100257933731645 0.1096012775866648 -0.2295565425144355 -131 -0.1260029488506564 0.01924803627921851 -0.04514756175154669 -132 -0.3274916753321522 0.2126469863019327 -0.2441346802061977 -133 -0.3930624642388476 0.2096382202713128 -0.1030058858503559 -134 -0.1377414157094548 0.03113853921493565 -0.1012793664439137 -135 -0.1837584330923711 0.03932459639539482 -0.05557571388620624 -136 -0.04481392763519742 0.00988195154271021 -0.08243042138319094 -137 -0.2094740885420212 0.2149426441037691 -0.3525504153552319 -138 -0.07521605699446073 0.00791551692341036 -0.03478846531967798 -139 -0.06531543207173005 0.03648831904394434 -0.1730976388881802 -140 -0.02675645878115182 0.003107347545271977 -0.03724242936608655 -141 -0.09583227149044218 0.07055155942353086 -0.2356487125920023 -142 -0.03888821862350794 0.01985250619428225 -0.1303257290667006 -143 -0.3242855760349301 0.3710830892471844 -0.3577156153652485 -144 -0.2382429598580649 0.0653238881213587 -0.0585373181515702 -145 -0.1077486976584885 0.1268390580246744 -0.3136778724313156 -146 -0.4830630802292958 0.414114472302875 -0.095398981106598 -147 -0.1463026782018779 0.3487538448363644 -0.4532291193081574 -148 -0.0811582162331508 0.2212159869637915 -0.406367136942947 -149 -0.1276107561129365 0.06593723234649607 0.2107982047503202 -150 -0.1220801448173375 0.02365951772000219 0.08510289194896387 -151 -0.05307174182177589 0.01107310412048446 0.08458739216848449 -152 -0.05169687645593012 0.005011266150083793 0.03636768976244218 -153 -0.1928282823974884 0.3176820155563101 0.4233341116507593 -154 -0.02352210971946236 0.002276959252752064 0.02687078305826674 -155 -0.1631188237662109 0.04753007216550154 0.1332564215447143 -156 -0.1049003239427436 0.1147641772996066 0.2996961983403488 -157 -0.2404700989938842 0.1114880991445034 0.2011333154447799 -158 -0.2212883920065129 0.182065242614978 0.3151381730208657 -159 -0.1709264827687797 0.03396832027046554 0.05162894166360223 -160 -0.102998050604012 0.2096580968951863 0.3930792503644001 -161 -0.0933916370338518 0.02991688777820761 0.139135558041672 -162 -0.08383120440708541 0.01050095183397221 0.0488161132811513 -163 -0.05261999367637136 0.03979035590894975 0.185786976031436 -164 -0.3425569736617763 0.2168003917822398 0.2277834552476467 -165 -0.02597937104259768 0.004542856594365485 0.05343572813902969 -166 -0.1243863629557978 0.01782384115537544 0.03269299978256259 -167 -0.03848928023711887 0.0219340374716438 0.1378926352406396 -168 -0.3538544094545784 0.3698995952023901 0.328023994200812 -169 -0.05762953958337545 0.06545538587521432 0.2387042632093104 -170 -0.3156983064741865 0.1284734616857344 0.1075107322127452 -171 -0.2534710249002152 0.07670560197956588 0.075674984932353 -172 -0.0954136687094799 0.4141335181522915 0.4830636046679561 -173 -0.4494105540238104 0.3264964368315083 0.1325845404770558 -174 -0.1777405304838007 0.1142354697779946 0.2623385255456938 -175 -0.2887756817473827 0.263871202151006 0.3322326577295273 -176 -0.3836700782387754 0.1958091381423351 0.09826397561073739 -177 0 0.501 0 -178 0.25 0.501 -0.04972809184478087 -179 -0.25 0.501 0.04972809184478087 -180 -0.04051704835486511 0.501 -0.2036929572993333 -181 0.0405170483548651 0.501 0.2036929572993333 -182 -0.1657176666716914 0.501 0.2480140149160559 -183 0.2480140149160559 0.501 0.1657176666716914 -184 0.1657176666716914 0.501 -0.2480140149160559 -185 -0.2480140149160559 0.501 -0.1657176666716914 -186 -0.3123259623660284 0.501 0.1896088164961787 -187 0.1916334594949479 0.501 0.3084633471684052 -188 0.3123259623660284 0.501 -0.1896088164961787 -189 -0.1916334594949479 0.501 -0.3084633471684052 -190 0.3611117168052297 0.501 0.05565373344995961 -191 -0.3611117168052297 0.501 -0.05565373344995961 -192 0.05900241851885195 0.501 -0.3583179230142754 -193 -0.05900241851885195 0.501 0.3583179230142754 -194 0.1412841281997918 0.501 0.05700179487148319 -195 0.1087158718002082 0.501 -0.1067298867162641 -196 -0.1087158718002082 0.501 0.1067298867162641 -197 -0.1412841281997918 0.501 -0.05700179487148319 -198 0.3770754890854197 0.501 -0.07500497821461394 -199 -0.3770754890854197 0.501 0.07500497821461394 -200 -0.07566646484542018 0.501 -0.3804010069479554 -201 0.07289796110260614 0.501 0.3664827987475708 -202 0 0 -1.806251016219083e-18 -203 0.2322100814617679 0 0.06581527448811327 -204 -0.2322100814617679 -0 -0.06581527448811327 -205 0.05072002804593711 0 -0.2250941140464751 -206 -0.05072002804593711 0 0.2250941140464751 -207 0.4619397662554605 -0.2 0.1913417161829864 -208 0.1913417161821035 -0.2 0.4619397662558262 -209 0.1913417161829864 -0.2 -0.4619397662554605 -210 0.4619397662558262 -0.2 -0.1913417161821035 -211 -0.4619397662554605 -0.2 -0.1913417161829864 -212 -0.1913417161821035 -0.2 -0.4619397662558262 -213 -0.1913417161829864 -0.2 0.4619397662554605 -214 -0.4619397662558262 -0.2 0.1913417161821035 -215 0 -0.4 1.806251016219083e-18 -216 -0.06581527448811327 -0.4 0.2322100814617679 -217 0.2283031375248289 -0.4 0.04920727987091737 -218 0.02700372320841774 -0.4 -0.2216015347510933 -219 -0.2197521824364575 -0.4 -0.02832376079942922 -220 0.02299718301224581 0.2511445834658444 0.02064819150212004 -221 0.02194450210373 0.1558073109730609 0.01514374991128849 -222 -0.02485952661308913 0.1531560090712724 -0.1199315050310883 -223 -0.1553905389363228 0.1943319430752262 -0.004569572116810727 -224 -0.01156008344953839 0.1370822854228775 0.1506733783124888 -225 0.008905847012670125 0.06277424322096692 0.008905847012691584 -226 0.1731655237155815 0.2168151339181799 0.03248019351003553 -227 0.1312066933962472 0.2845147299571598 -0.1557389243163806 -228 -0.08046528840242292 0.0986993867277498 0.01967856046728051 -229 -0.1623284412415345 0.301149813315956 0.1500296229906809 -230 0.06902243494332924 0.09441738725982655 -0.04591735206136249 -231 0.106799202159151 0.3483404575033952 0.2267422402623986 -232 -0.1111891196310109 0.32507859528968 -0.1294339775742908 -233 -0.01817237001894838 0.07179524020414875 -0.05287087375340723 -234 0.05796725988949247 0.09665870038904446 0.07542504674899228 -235 -0.02317077652148489 0.07195625057658296 0.0697879449538196 -236 -0.1068697031933587 0.09578305895319485 -0.08258796665385035 -237 0.09154941239736276 0.1669143618780818 -0.1257191456718838 -238 -0.2830123577922874 0.3262901965126527 -0.02285002534186089 -239 0.05493031621402608 0.05159530137005672 -0.007074043664281555 -240 0.007409151552480313 0.2463137348284158 -0.2364951862329169 -241 -0.0457463814862057 0.2482209345843405 0.2417535833456651 -242 0.01575203213457178 0.08545736877115366 -0.1175148703607351 -243 0.134112498409321 0.3505667337798891 -0.006334280976417715 -244 -0.03371829664129062 0.06032435460162649 0.01316038227945489 -245 -0.1402825501855814 0.1474920709316569 0.1273619985264371 -246 0.2675911824086226 0.3276952401642054 0.1270432913306665 -247 -0.004285758068775724 0.03158228706091545 -0.01392868123516653 -248 -0.1495106567958615 0.1913973904478573 -0.1444242089573229 -249 0.1757898240916013 0.1518458765706439 -0.0692618548827785 -250 0.2998421209408237 0.3177115680111848 -0.05367116740470231 -251 0.1147909573751037 0.176576726700094 0.1599536503429053 -252 -0.06466395022322634 0.3641759080245217 0.05838224552096206 -253 0.1290436097322548 0.09134243330132084 0.01187750410539126 -254 -0.07068034381074993 0.2178519946864788 0.08072662271773798 -255 0.01599560954945456 0.03940698948097516 0.03838739241997892 -$EndNodes -$Elements -1118 -1 2 2 5 1 43 1 24 -2 2 2 5 1 95 33 2 -3 2 2 5 1 59 95 2 -4 2 2 5 1 34 94 5 -5 2 2 5 1 94 57 5 -6 2 2 5 1 78 24 25 -7 2 2 5 1 43 24 78 -8 2 2 5 1 86 25 26 -9 2 2 5 1 25 86 78 -10 2 2 5 1 76 26 27 -11 2 2 5 1 76 86 26 -12 2 2 5 1 27 28 90 -13 2 2 5 1 90 76 27 -14 2 2 5 1 28 29 90 -15 2 2 5 1 93 29 30 -16 2 2 5 1 29 74 90 -17 2 2 5 1 93 74 29 -18 2 2 5 1 30 31 80 -19 2 2 5 1 93 30 80 -20 2 2 5 1 84 31 32 -21 2 2 5 1 31 84 80 -22 2 2 5 1 33 84 32 -23 2 2 5 1 33 95 77 -24 2 2 5 1 33 77 84 -25 2 2 5 1 94 34 35 -26 2 2 5 1 36 96 35 -27 2 2 5 1 35 96 94 -28 2 2 5 1 37 97 36 -29 2 2 5 1 36 97 96 -30 2 2 5 1 38 89 37 -31 2 2 5 1 89 97 37 -32 2 2 5 1 83 38 39 -33 2 2 5 1 38 83 89 -34 2 2 5 1 88 39 40 -35 2 2 5 1 39 88 83 -36 2 2 5 1 87 40 41 -37 2 2 5 1 88 40 87 -38 2 2 5 1 92 41 42 -39 2 2 5 1 41 92 87 -40 2 2 5 1 42 43 78 -41 2 2 5 1 78 92 42 -42 2 2 5 1 91 58 57 -43 2 2 5 1 94 91 57 -44 2 2 5 1 91 59 58 -45 2 2 5 1 77 59 91 -46 2 2 5 1 95 59 77 -47 2 2 5 1 92 86 87 -48 2 2 5 1 78 86 92 -49 2 2 5 1 88 87 75 -50 2 2 5 1 75 87 76 -51 2 2 5 1 87 86 76 -52 2 2 5 1 81 97 89 -53 2 2 5 1 89 83 79 -54 2 2 5 1 89 79 81 -55 2 2 5 1 82 91 85 -56 2 2 5 1 81 82 85 -57 2 2 5 1 82 77 91 -58 2 2 5 1 82 80 84 -59 2 2 5 1 81 80 82 -60 2 2 5 1 82 84 77 -61 2 2 5 1 94 85 91 -62 2 2 5 1 96 85 94 -63 2 2 5 1 85 96 97 -64 2 2 5 1 97 81 85 -65 2 2 5 1 74 93 80 -66 2 2 5 1 81 74 80 -67 2 2 5 1 75 90 79 -68 2 2 5 1 76 90 75 -69 2 2 5 1 90 74 79 -70 2 2 5 1 88 75 83 -71 2 2 5 1 83 75 79 -72 2 2 5 1 74 81 79 -73 2 2 5 2 1 44 24 -74 2 2 5 2 33 117 2 -75 2 2 5 2 117 60 2 -76 2 2 5 2 116 53 4 -77 2 2 5 2 62 116 4 -78 2 2 5 2 25 24 101 -79 2 2 5 2 24 44 101 -80 2 2 5 2 25 99 26 -81 2 2 5 2 25 101 99 -82 2 2 5 2 110 27 26 -83 2 2 5 2 99 110 26 -84 2 2 5 2 27 113 28 -85 2 2 5 2 27 110 113 -86 2 2 5 2 106 29 28 -87 2 2 5 2 113 106 28 -88 2 2 5 2 29 123 30 -89 2 2 5 2 29 106 123 -90 2 2 5 2 30 121 31 -91 2 2 5 2 30 123 121 -92 2 2 5 2 31 122 32 -93 2 2 5 2 31 121 122 -94 2 2 5 2 117 33 32 -95 2 2 5 2 32 122 117 -96 2 2 5 2 101 44 45 -97 2 2 5 2 46 109 45 -98 2 2 5 2 45 109 101 -99 2 2 5 2 115 46 47 -100 2 2 5 2 46 115 109 -101 2 2 5 2 115 47 48 -102 2 2 5 2 120 48 49 -103 2 2 5 2 120 115 48 -104 2 2 5 2 118 49 50 -105 2 2 5 2 118 120 49 -106 2 2 5 2 50 51 103 -107 2 2 5 2 118 50 103 -108 2 2 5 2 107 51 52 -109 2 2 5 2 51 107 103 -110 2 2 5 2 53 107 52 -111 2 2 5 2 53 100 107 -112 2 2 5 2 53 116 100 -113 2 2 5 2 114 61 60 -114 2 2 5 2 117 114 60 -115 2 2 5 2 114 62 61 -116 2 2 5 2 100 62 114 -117 2 2 5 2 116 62 100 -118 2 2 5 2 98 112 113 -119 2 2 5 2 113 112 102 -120 2 2 5 2 113 110 98 -121 2 2 5 2 106 113 102 -122 2 2 5 2 112 118 102 -123 2 2 5 2 120 118 112 -124 2 2 5 2 119 118 103 -125 2 2 5 2 118 119 102 -126 2 2 5 2 111 123 106 -127 2 2 5 2 123 111 121 -128 2 2 5 2 111 102 104 -129 2 2 5 2 104 121 111 -130 2 2 5 2 111 106 102 -131 2 2 5 2 98 115 112 -132 2 2 5 2 112 115 120 -133 2 2 5 2 104 119 103 -134 2 2 5 2 119 104 102 -135 2 2 5 2 105 100 114 -136 2 2 5 2 105 114 108 -137 2 2 5 2 117 108 114 -138 2 2 5 2 110 99 109 -139 2 2 5 2 101 109 99 -140 2 2 5 2 104 103 105 -141 2 2 5 2 104 105 108 -142 2 2 5 2 105 107 100 -143 2 2 5 2 105 103 107 -144 2 2 5 2 108 122 121 -145 2 2 5 2 122 108 117 -146 2 2 5 2 110 109 98 -147 2 2 5 2 115 98 109 -148 2 2 5 2 121 104 108 -149 2 2 5 3 126 134 125 -150 2 2 5 3 136 126 125 -151 2 2 5 3 125 134 128 -152 2 2 5 3 139 125 128 -153 2 2 5 3 125 142 136 -154 2 2 5 3 142 125 139 -155 2 2 5 3 126 131 134 -156 2 2 5 3 126 138 131 -157 2 2 5 3 136 138 126 -158 2 2 5 3 132 133 127 -159 2 2 5 3 132 127 143 -160 2 2 5 3 14 127 133 -161 2 2 5 3 127 65 143 -162 2 2 5 3 14 146 127 -163 2 2 5 3 146 65 127 -164 2 2 5 3 124 130 128 -165 2 2 5 3 134 124 128 -166 2 2 5 3 130 124 129 -167 2 2 5 3 124 144 129 -168 2 2 5 3 135 124 134 -169 2 2 5 3 144 124 135 -170 2 2 5 3 141 128 130 -171 2 2 5 3 128 141 139 -172 2 2 5 3 130 129 132 -173 2 2 5 3 132 129 133 -174 2 2 5 3 16 133 129 -175 2 2 5 3 144 17 129 -176 2 2 5 3 17 16 129 -177 2 2 5 3 130 132 137 -178 2 2 5 3 137 145 130 -179 2 2 5 3 145 141 130 -180 2 2 5 3 134 131 135 -181 2 2 5 3 135 131 19 -182 2 2 5 3 138 20 131 -183 2 2 5 3 19 131 20 -184 2 2 5 3 132 143 137 -185 2 2 5 3 14 133 15 -186 2 2 5 3 133 16 15 -187 2 2 5 3 135 18 144 -188 2 2 5 3 135 19 18 -189 2 2 5 3 140 138 136 -190 2 2 5 3 136 46 140 -191 2 2 5 3 142 47 136 -192 2 2 5 3 136 47 46 -193 2 2 5 3 147 137 143 -194 2 2 5 3 137 148 145 -195 2 2 5 3 148 137 147 -196 2 2 5 3 140 22 138 -197 2 2 5 3 20 138 21 -198 2 2 5 3 138 22 21 -199 2 2 5 3 49 139 141 -200 2 2 5 3 139 48 142 -201 2 2 5 3 139 49 48 -202 2 2 5 3 140 23 22 -203 2 2 5 3 44 23 140 -204 2 2 5 3 44 140 45 -205 2 2 5 3 140 46 45 -206 2 2 5 3 50 141 145 -207 2 2 5 3 50 49 141 -208 2 2 5 3 142 48 47 -209 2 2 5 3 147 143 63 -210 2 2 5 3 143 64 63 -211 2 2 5 3 143 65 64 -212 2 2 5 3 144 18 17 -213 2 2 5 3 51 145 148 -214 2 2 5 3 50 145 51 -215 2 2 5 3 146 14 3 -216 2 2 5 3 65 146 3 -217 2 2 5 3 147 53 148 -218 2 2 5 3 53 147 4 -219 2 2 5 3 147 63 4 -220 2 2 5 3 51 148 52 -221 2 2 5 3 148 53 52 -222 2 2 5 3 44 1 23 -223 2 2 5 4 151 161 150 -224 2 2 5 4 167 161 151 -225 2 2 5 4 161 149 155 -226 2 2 5 4 150 161 155 -227 2 2 5 4 163 149 161 -228 2 2 5 4 161 167 163 -229 2 2 5 4 164 170 157 -230 2 2 5 4 170 171 157 -231 2 2 5 4 164 176 170 -232 2 2 5 4 16 170 176 -233 2 2 5 4 17 171 170 -234 2 2 5 4 17 170 16 -235 2 2 5 4 174 157 149 -236 2 2 5 4 157 174 158 -237 2 2 5 4 149 157 155 -238 2 2 5 4 171 155 157 -239 2 2 5 4 157 158 164 -240 2 2 5 4 152 165 151 -241 2 2 5 4 162 152 151 -242 2 2 5 4 165 41 151 -243 2 2 5 4 150 162 151 -244 2 2 5 4 40 167 151 -245 2 2 5 4 151 41 40 -246 2 2 5 4 168 175 153 -247 2 2 5 4 175 158 153 -248 2 2 5 4 175 168 164 -249 2 2 5 4 158 175 164 -250 2 2 5 4 158 160 153 -251 2 2 5 4 34 153 160 -252 2 2 5 4 153 56 168 -253 2 2 5 4 34 172 153 -254 2 2 5 4 172 56 153 -255 2 2 5 4 156 174 149 -256 2 2 5 4 174 156 158 -257 2 2 5 4 152 154 165 -258 2 2 5 4 22 154 152 -259 2 2 5 4 152 162 21 -260 2 2 5 4 22 152 21 -261 2 2 5 4 159 150 155 -262 2 2 5 4 171 159 155 -263 2 2 5 4 166 162 150 -264 2 2 5 4 166 150 159 -265 2 2 5 4 166 20 162 -266 2 2 5 4 19 166 159 -267 2 2 5 4 166 19 20 -268 2 2 5 4 165 154 42 -269 2 2 5 4 41 165 42 -270 2 2 5 4 158 156 160 -271 2 2 5 4 36 160 156 -272 2 2 5 4 34 160 35 -273 2 2 5 4 160 36 35 -274 2 2 5 4 176 164 173 -275 2 2 5 4 173 164 168 -276 2 2 5 4 15 176 173 -277 2 2 5 4 16 176 15 -278 2 2 5 4 149 169 156 -279 2 2 5 4 169 149 163 -280 2 2 5 4 169 37 156 -281 2 2 5 4 37 36 156 -282 2 2 5 4 173 168 54 -283 2 2 5 4 168 55 54 -284 2 2 5 4 168 56 55 -285 2 2 5 4 163 38 169 -286 2 2 5 4 169 38 37 -287 2 2 5 4 172 34 5 -288 2 2 5 4 56 172 5 -289 2 2 5 4 14 173 3 -290 2 2 5 4 173 54 3 -291 2 2 5 4 173 14 15 -292 2 2 5 4 23 154 22 -293 2 2 5 4 23 43 154 -294 2 2 5 4 43 42 154 -295 2 2 5 4 39 163 167 -296 2 2 5 4 163 39 38 -297 2 2 5 4 171 18 159 -298 2 2 5 4 18 171 17 -299 2 2 5 4 40 39 167 -300 2 2 5 4 162 20 21 -301 2 2 5 4 159 18 19 -302 2 2 5 4 1 43 23 -303 2 2 1 5 177 196 181 -304 2 2 1 5 177 197 196 -305 2 2 1 5 179 196 197 -306 2 2 1 5 179 182 196 -307 2 2 1 5 181 196 182 -308 2 2 1 5 179 191 199 -309 2 2 1 5 3 199 191 -310 2 2 1 5 179 199 186 -311 2 2 1 5 54 186 199 -312 2 2 1 5 3 54 199 -313 2 2 1 5 178 183 190 -314 2 2 1 5 178 194 183 -315 2 2 1 5 178 184 195 -316 2 2 1 5 178 195 194 -317 2 2 1 5 178 198 188 -318 2 2 1 5 178 190 198 -319 2 2 1 5 178 188 184 -320 2 2 1 5 180 200 189 -321 2 2 1 5 180 189 185 -322 2 2 1 5 63 189 200 -323 2 2 1 5 64 185 189 -324 2 2 1 5 63 64 189 -325 2 2 1 5 179 185 191 -326 2 2 1 5 65 191 185 -327 2 2 1 5 3 191 65 -328 2 2 1 5 177 195 180 -329 2 2 1 5 177 180 197 -330 2 2 1 5 177 194 195 -331 2 2 1 5 177 181 194 -332 2 2 1 5 180 192 200 -333 2 2 1 5 180 184 192 -334 2 2 1 5 180 195 184 -335 2 2 1 5 180 185 197 -336 2 2 1 5 179 186 182 -337 2 2 1 5 55 182 186 -338 2 2 1 5 54 55 186 -339 2 2 1 5 59 190 183 -340 2 2 1 5 181 187 183 -341 2 2 1 5 181 183 194 -342 2 2 1 5 58 183 187 -343 2 2 1 5 58 59 183 -344 2 2 1 5 179 197 185 -345 2 2 1 5 4 200 192 -346 2 2 1 5 62 192 184 -347 2 2 1 5 4 192 62 -348 2 2 1 5 60 188 198 -349 2 2 1 5 2 198 190 -350 2 2 1 5 2 60 198 -351 2 2 1 5 4 63 200 -352 2 2 1 5 61 184 188 -353 2 2 1 5 60 61 188 -354 2 2 1 5 64 65 185 -355 2 2 1 5 2 190 59 -356 2 2 1 5 181 193 201 -357 2 2 1 5 181 182 193 -358 2 2 1 5 181 201 187 -359 2 2 1 5 61 62 184 -360 2 2 1 5 5 201 193 -361 2 2 1 5 56 193 182 -362 2 2 1 5 5 193 56 -363 2 2 1 5 57 187 201 -364 2 2 1 5 57 58 187 -365 2 2 1 5 5 57 201 -366 2 2 1 5 55 56 182 -367 2 2 2 6 202 206 203 -368 2 2 2 6 202 203 205 -369 2 2 2 6 202 204 206 -370 2 2 2 6 202 205 204 -371 2 2 2 6 206 67 203 -372 2 2 2 6 68 205 203 -373 2 2 2 6 6 203 67 -374 2 2 2 6 6 68 203 -375 2 2 2 6 66 206 204 -376 2 2 2 6 9 206 66 -377 2 2 2 6 9 67 206 -378 2 2 2 6 205 69 204 -379 2 2 2 6 7 66 204 -380 2 2 2 6 7 204 69 -381 2 2 2 6 8 205 68 -382 2 2 2 6 8 69 205 -383 4 2 3 1 45 101 109 247 -384 4 2 3 1 220 224 241 254 -385 4 2 3 1 220 243 232 252 -386 4 2 3 1 231 243 220 252 -387 4 2 3 1 200 232 147 240 -388 4 2 3 1 227 232 220 243 -389 4 2 3 1 108 188 227 250 -390 4 2 3 1 200 180 232 240 -391 4 2 3 1 101 239 109 247 -392 4 2 3 1 40 39 88 235 -393 4 2 3 1 220 241 231 252 -394 4 2 3 1 170 171 17 223 -395 4 2 3 1 137 147 232 240 -396 4 2 3 1 220 221 224 254 -397 4 2 3 1 195 232 227 243 -398 4 2 3 1 189 147 200 232 -399 4 2 3 1 137 148 147 240 -400 4 2 3 1 24 1 43 247 -401 4 2 3 1 170 171 223 245 -402 4 2 3 1 148 52 53 240 -403 4 2 3 1 230 237 226 249 -404 4 2 3 1 180 189 200 232 -405 4 2 3 1 200 53 192 240 -406 4 2 3 1 147 148 53 240 -407 4 2 3 1 20 21 138 228 -408 4 2 3 1 107 53 52 240 -409 4 2 3 1 178 227 188 250 -410 4 2 3 1 25 24 78 255 -411 4 2 3 1 100 227 184 240 -412 4 2 3 1 185 132 232 238 -413 4 2 3 1 45 109 233 247 -414 4 2 3 1 149 169 224 241 -415 4 2 3 1 198 33 190 250 -416 4 2 3 1 220 227 226 237 -417 4 2 3 1 21 138 228 244 -418 4 2 3 1 198 178 188 250 -419 4 2 3 1 147 53 200 240 -420 4 2 3 1 198 188 117 250 -421 4 2 3 1 232 238 132 248 -422 4 2 3 1 150 151 162 235 -423 4 2 3 1 137 240 232 248 -424 4 2 3 1 35 34 231 241 -425 4 2 3 1 196 181 229 252 -426 4 2 3 1 227 232 180 240 -427 4 2 3 1 180 200 192 240 -428 4 2 3 1 39 38 83 224 -429 4 2 3 1 167 39 40 235 -430 4 2 3 1 226 237 227 249 -431 4 2 3 1 17 144 129 223 -432 4 2 3 1 108 117 188 250 -433 4 2 3 1 161 224 167 235 -434 4 2 3 1 222 223 220 232 -435 4 2 3 1 186 229 173 238 -436 4 2 3 1 195 177 232 243 -437 4 2 3 1 192 100 184 240 -438 4 2 3 1 167 224 39 235 -439 4 2 3 1 186 173 199 238 -440 4 2 3 1 232 243 177 252 -441 4 2 3 1 166 20 19 228 -442 4 2 3 1 186 199 179 238 -443 4 2 3 1 174 241 149 245 -444 4 2 3 1 224 245 241 254 -445 4 2 3 1 192 53 100 240 -446 4 2 3 1 180 184 227 240 -447 4 2 3 1 180 227 195 232 -448 4 2 3 1 150 162 228 235 -449 4 2 3 1 137 145 240 248 -450 4 2 3 1 46 45 109 233 -451 4 2 3 1 83 234 224 251 -452 4 2 3 1 167 163 39 224 -453 4 2 3 1 137 232 132 248 -454 4 2 3 1 186 164 173 229 -455 4 2 3 1 157 229 174 245 -456 4 2 3 1 174 229 241 245 -457 4 2 3 1 226 231 220 251 -458 4 2 3 1 18 135 144 223 -459 4 2 3 1 153 229 182 241 -460 4 2 3 1 186 179 229 238 -461 4 2 3 1 225 221 233 244 -462 4 2 3 1 173 229 176 238 -463 4 2 3 1 161 163 167 224 -464 4 2 3 1 223 229 245 254 -465 4 2 3 1 107 100 53 240 -466 4 2 3 1 178 243 227 250 -467 4 2 3 1 114 108 188 227 -468 4 2 3 1 175 153 158 229 -469 4 2 3 1 220 231 226 243 -470 4 2 3 1 174 156 149 241 -471 4 2 3 1 149 241 224 245 -472 4 2 3 1 30 93 80 226 -473 4 2 3 1 109 239 233 247 -474 4 2 3 1 221 226 234 253 -475 4 2 3 1 95 190 33 246 -476 4 2 3 1 166 19 159 228 -477 4 2 3 1 40 88 87 235 -478 4 2 3 1 221 230 226 253 -479 4 2 3 1 180 192 184 240 -480 4 2 3 1 198 190 178 250 -481 4 2 3 1 108 249 121 250 -482 4 2 3 1 166 150 162 228 -483 4 2 3 1 164 176 173 229 -484 4 2 3 1 33 246 190 250 -485 4 2 3 1 141 222 240 248 -486 4 2 3 1 41 235 87 255 -487 4 2 3 1 170 176 229 238 -488 4 2 3 1 149 156 169 241 -489 4 2 3 1 182 229 181 241 -490 4 2 3 1 108 227 249 250 -491 4 2 3 1 169 37 224 241 -492 4 2 3 1 141 222 50 240 -493 4 2 3 1 19 223 228 236 -494 4 2 3 1 153 182 193 241 -495 4 2 3 1 223 252 229 254 -496 4 2 3 1 121 108 104 249 -497 4 2 3 1 118 120 112 242 -498 4 2 3 1 161 149 163 224 -499 4 2 3 1 142 136 47 233 -500 4 2 3 1 161 151 150 235 -501 4 2 3 1 153 193 34 241 -502 4 2 3 1 185 127 132 238 -503 4 2 3 1 150 166 159 228 -504 4 2 3 1 170 229 157 245 -505 4 2 3 1 125 139 128 236 -506 4 2 3 1 223 220 252 254 -507 4 2 3 1 153 158 229 241 -508 4 2 3 1 108 227 104 249 -509 4 2 3 1 94 34 201 231 -510 4 2 3 1 24 43 78 255 -511 4 2 3 1 161 224 235 245 -512 4 2 3 1 221 222 230 233 -513 4 2 3 1 132 137 143 232 -514 4 2 3 1 149 169 163 224 -515 4 2 3 1 169 37 38 224 -516 4 2 3 1 139 49 141 222 -517 4 2 3 1 233 239 225 247 -518 4 2 3 1 35 231 96 241 -519 4 2 3 1 132 143 185 232 -520 4 2 3 1 18 144 17 223 -521 4 2 3 1 19 131 135 236 -522 4 2 3 1 226 227 220 243 -523 4 2 3 1 139 142 48 242 -524 4 2 3 1 137 145 148 240 -525 4 2 3 1 186 168 164 229 -526 4 2 3 1 223 220 232 252 -527 4 2 3 1 185 143 189 232 -528 4 2 3 1 21 20 162 228 -529 4 2 3 1 153 193 172 34 -530 4 2 3 1 154 165 42 255 -531 4 2 3 1 86 25 78 255 -532 4 2 3 1 153 34 160 241 -533 4 2 3 1 223 228 221 254 -534 4 2 3 1 193 182 181 241 -535 4 2 3 1 170 176 164 229 -536 4 2 3 1 154 43 247 255 -537 4 2 3 1 141 240 145 248 -538 4 2 3 1 129 238 223 248 -539 4 2 3 1 127 191 146 238 -540 4 2 3 1 141 49 50 222 -541 4 2 3 1 37 36 97 241 -542 4 2 3 1 21 228 162 244 -543 4 2 3 1 171 18 17 223 -544 4 2 3 1 223 232 222 248 -545 4 2 3 1 83 79 75 234 -546 4 2 3 1 196 181 182 229 -547 4 2 3 1 94 35 34 231 -548 4 2 3 1 198 117 33 250 -549 4 2 3 1 28 106 113 253 -550 4 2 3 1 41 40 87 235 -551 4 2 3 1 157 158 174 229 -552 4 2 3 1 114 188 184 227 -553 4 2 3 1 49 120 118 242 -554 4 2 3 1 24 247 43 255 -555 4 2 3 1 20 166 162 228 -556 4 2 3 1 25 239 24 255 -557 4 2 3 1 174 229 158 241 -558 4 2 3 1 154 42 43 255 -559 4 2 3 1 96 35 94 231 -560 4 2 3 1 94 201 187 231 -561 4 2 3 1 150 228 159 245 -562 4 2 3 1 139 49 222 242 -563 4 2 3 1 103 237 227 240 -564 4 2 3 1 29 93 30 226 -565 4 2 3 1 104 227 103 237 -566 4 2 3 1 36 96 97 241 -567 4 2 3 1 101 24 239 247 -568 4 2 3 1 141 50 145 240 -569 4 2 3 1 178 184 188 227 -570 4 2 3 1 53 192 100 116 -571 4 2 3 1 101 24 25 239 -572 4 2 3 1 178 190 246 250 -573 4 2 3 1 178 195 227 243 -574 4 2 3 1 87 235 234 255 -575 4 2 3 1 225 221 234 239 -576 4 2 3 1 104 227 237 249 -577 4 2 3 1 127 146 14 238 -578 4 2 3 1 151 161 167 235 -579 4 2 3 1 21 22 138 244 -580 4 2 3 1 241 245 229 254 -581 4 2 3 1 180 184 195 227 -582 4 2 3 1 77 95 33 246 -583 4 2 3 1 31 30 80 226 -584 4 2 3 1 115 98 112 242 -585 4 2 3 1 175 164 168 229 -586 4 2 3 1 139 48 49 242 -587 4 2 3 1 228 235 162 244 -588 4 2 3 1 86 92 87 255 -589 4 2 3 1 159 228 223 245 -590 4 2 3 1 169 38 163 224 -591 4 2 3 1 227 226 249 250 -592 4 2 3 1 104 103 119 237 -593 4 2 3 1 160 34 35 241 -594 4 2 3 1 221 225 235 244 -595 4 2 3 1 225 239 234 255 -596 4 2 3 1 231 243 194 246 -597 4 2 3 1 180 195 177 232 -598 4 2 3 1 74 80 226 251 -599 4 2 3 1 79 234 83 251 -600 4 2 3 1 113 102 112 230 -601 4 2 3 1 88 234 87 235 -602 4 2 3 1 178 195 184 227 -603 4 2 3 1 136 138 140 233 -604 4 2 3 1 223 238 229 252 -605 4 2 3 1 170 164 157 229 -606 4 2 3 1 230 233 222 242 -607 4 2 3 1 228 233 221 244 -608 4 2 3 1 93 74 80 226 -609 4 2 3 1 233 236 222 242 -610 4 2 3 1 106 28 29 253 -611 4 2 3 1 79 90 75 234 -612 4 2 3 1 1 24 44 247 -613 4 2 3 1 170 16 176 238 -614 4 2 3 1 27 230 110 239 -615 4 2 3 1 163 38 39 224 -616 4 2 3 1 108 114 105 227 -617 4 2 3 1 88 83 75 234 -618 4 2 3 1 97 241 231 251 -619 4 2 3 1 185 191 127 238 -620 4 2 3 1 161 149 224 245 -621 4 2 3 1 224 221 234 235 -622 4 2 3 1 225 244 233 247 -623 4 2 3 1 96 231 97 241 -624 4 2 3 1 178 246 243 250 -625 4 2 3 1 102 112 230 237 -626 4 2 3 1 142 233 47 242 -627 4 2 3 1 199 173 14 238 -628 4 2 3 1 230 233 109 239 -629 4 2 3 1 80 246 226 251 -630 4 2 3 1 127 133 132 238 -631 4 2 3 1 223 232 238 252 -632 4 2 3 1 124 223 236 248 -633 4 2 3 1 181 187 201 231 -634 4 2 3 1 230 237 112 242 -635 4 2 3 1 234 235 225 255 -636 4 2 3 1 24 101 44 247 -637 4 2 3 1 136 46 47 233 -638 4 2 3 1 186 182 168 229 -639 4 2 3 1 44 101 45 247 -640 4 2 3 1 196 177 181 252 -641 4 2 3 1 85 231 91 246 -642 4 2 3 1 169 156 37 241 -643 4 2 3 1 94 187 91 231 -644 4 2 3 1 102 230 113 249 -645 4 2 3 1 223 238 232 248 -646 4 2 3 1 126 131 138 236 -647 4 2 3 1 153 160 158 241 -648 4 2 3 1 82 81 85 251 -649 4 2 3 1 222 237 230 242 -650 4 2 3 1 174 158 156 241 -651 4 2 3 1 154 244 165 255 -652 4 2 3 1 234 239 221 253 -653 4 2 3 1 98 113 112 230 -654 4 2 3 1 226 243 231 246 -655 4 2 3 1 232 240 222 248 -656 4 2 3 1 109 233 230 242 -657 4 2 3 1 183 231 194 246 -658 4 2 3 1 85 94 91 231 -659 4 2 3 1 165 41 42 255 -660 4 2 3 1 1 23 43 247 -661 4 2 3 1 30 121 123 249 -662 4 2 3 1 161 150 155 245 -663 4 2 3 1 185 232 197 238 -664 4 2 3 1 186 164 168 173 -665 4 2 3 1 106 102 113 249 -666 4 2 3 1 227 243 226 250 -667 4 2 3 1 178 194 243 246 -668 4 2 3 1 110 27 113 230 -669 4 2 3 1 109 101 99 239 -670 4 2 3 1 23 154 43 247 -671 4 2 3 1 230 221 239 253 -672 4 2 3 1 221 228 235 254 -673 4 2 3 1 29 226 30 249 -674 4 2 3 1 127 185 132 143 -675 4 2 3 1 177 197 232 252 -676 4 2 3 1 108 114 188 117 -677 4 2 3 1 197 238 232 252 -678 4 2 3 1 98 230 112 242 -679 4 2 3 1 164 175 158 229 -680 4 2 3 1 225 234 221 235 -681 4 2 3 1 86 239 25 255 -682 4 2 3 1 226 249 29 253 -683 4 2 3 1 124 134 128 236 -684 4 2 3 1 103 104 105 227 -685 4 2 3 1 124 135 134 236 -686 4 2 3 1 104 108 105 227 -687 4 2 3 1 179 182 186 229 -688 4 2 3 1 199 191 179 238 -689 4 2 3 1 118 112 237 242 -690 4 2 3 1 102 237 230 249 -691 4 2 3 1 229 238 179 252 -692 4 2 3 1 226 246 231 251 -693 4 2 3 1 145 51 148 240 -694 4 2 3 1 74 81 80 251 -695 4 2 3 1 85 96 94 231 -696 4 2 3 1 36 35 96 241 -697 4 2 3 1 221 235 224 254 -698 4 2 3 1 121 104 111 249 -699 4 2 3 1 157 164 158 229 -700 4 2 3 1 82 85 91 246 -701 4 2 3 1 110 109 99 239 -702 4 2 3 1 221 235 228 244 -703 4 2 3 1 92 41 87 255 -704 4 2 3 1 106 29 249 253 -705 4 2 3 1 101 25 99 239 -706 4 2 3 1 183 181 194 231 -707 4 2 3 1 189 180 185 232 -708 4 2 3 1 97 231 85 251 -709 4 2 3 1 130 145 137 248 -710 4 2 3 1 145 50 51 240 -711 4 2 3 1 196 182 179 229 -712 4 2 3 1 129 133 16 238 -713 4 2 3 1 183 187 181 231 -714 4 2 3 1 102 104 119 237 -715 4 2 3 1 196 229 179 252 -716 4 2 3 1 155 150 159 245 -717 4 2 3 1 157 174 149 245 -718 4 2 3 1 27 26 76 239 -719 4 2 3 1 152 21 162 244 -720 4 2 3 1 133 14 15 238 -721 4 2 3 1 180 177 197 232 -722 4 2 3 1 178 190 183 246 -723 4 2 3 1 176 15 173 238 -724 4 2 3 1 125 128 134 236 -725 4 2 3 1 122 117 108 250 -726 4 2 3 1 148 51 52 240 -727 4 2 3 1 230 249 226 253 -728 4 2 3 1 97 96 85 231 -729 4 2 3 1 127 14 133 238 -730 4 2 3 1 79 83 89 251 -731 4 2 3 1 27 28 113 253 -732 4 2 3 1 165 235 41 255 -733 4 2 3 1 140 45 233 247 -734 4 2 3 1 178 183 194 246 -735 4 2 3 1 84 77 33 246 -736 4 2 3 1 140 45 46 233 -737 4 2 3 1 176 16 15 238 -738 4 2 3 1 136 140 46 233 -739 4 2 3 1 90 76 75 234 -740 4 2 3 1 104 102 111 249 -741 4 2 3 1 124 236 128 248 -742 4 2 3 1 103 118 119 237 -743 4 2 3 1 130 137 132 248 -744 4 2 3 1 87 88 75 234 -745 4 2 3 1 29 30 123 249 -746 4 2 3 1 165 244 235 255 -747 4 2 3 1 222 236 223 248 -748 4 2 3 1 179 191 185 238 -749 4 2 3 1 74 29 90 253 -750 4 2 3 1 81 97 85 251 -751 4 2 3 1 26 86 76 239 -752 4 2 3 1 151 167 40 235 -753 4 2 3 1 104 237 102 249 -754 4 2 3 1 103 51 50 240 -755 4 2 3 1 76 87 75 234 -756 4 2 3 1 154 247 244 255 -757 4 2 3 1 108 121 122 250 -758 4 2 3 1 161 155 149 245 -759 4 2 3 1 102 118 112 237 -760 4 2 3 1 91 183 77 246 -761 4 2 3 1 179 185 197 238 -762 4 2 3 1 48 120 49 242 -763 4 2 3 1 76 239 234 253 -764 4 2 3 1 170 157 171 245 -765 4 2 3 1 142 47 48 242 -766 4 2 3 1 230 239 27 253 -767 4 2 3 1 173 15 14 238 -768 4 2 3 1 130 141 145 248 -769 4 2 3 1 185 180 197 232 -770 4 2 3 1 26 25 86 239 -771 4 2 3 1 118 102 119 237 -772 4 2 3 1 156 36 37 241 -773 4 2 3 1 98 110 113 230 -774 4 2 3 1 27 113 230 253 -775 4 2 3 1 131 134 135 236 -776 4 2 3 1 106 29 123 249 -777 4 2 3 1 51 107 52 240 -778 4 2 3 1 76 234 90 253 -779 4 2 3 1 179 238 197 252 -780 4 2 3 1 81 74 79 251 -781 4 2 3 1 103 107 51 240 -782 4 2 3 1 152 165 154 244 -783 4 2 3 1 243 246 226 250 -784 4 2 3 1 32 33 117 250 -785 4 2 3 1 155 159 171 245 -786 4 2 3 1 91 77 82 246 -787 4 2 3 1 129 130 132 248 -788 4 2 3 1 56 153 193 172 -789 4 2 3 1 32 117 122 250 -790 4 2 3 1 120 115 112 242 -791 4 2 3 1 133 15 16 238 -792 4 2 3 1 165 151 41 235 -793 4 2 3 1 160 156 158 241 -794 4 2 3 1 27 239 76 253 -795 4 2 3 1 151 40 41 235 -796 4 2 3 1 153 56 193 182 -797 4 2 3 1 157 155 171 245 -798 4 2 3 1 191 65 127 146 -799 4 2 3 1 60 198 188 117 -800 4 2 3 1 42 41 92 255 -801 4 2 3 1 157 149 155 245 -802 4 2 3 1 102 106 111 249 -803 4 2 3 1 29 28 90 253 -804 4 2 3 1 235 244 225 255 -805 4 2 3 1 56 153 168 182 -806 4 2 3 1 43 42 78 255 -807 4 2 3 1 199 186 54 173 -808 4 2 3 1 26 27 110 239 -809 4 2 3 1 126 125 134 236 -810 4 2 3 1 191 65 185 127 -811 4 2 3 1 131 126 134 236 -812 4 2 3 1 22 23 140 247 -813 4 2 3 1 128 141 130 248 -814 4 2 3 1 86 78 92 255 -815 4 2 3 1 65 185 127 143 -816 4 2 3 1 91 183 59 77 -817 4 2 3 1 114 62 100 184 -818 4 2 3 1 26 110 99 239 -819 4 2 3 1 123 121 111 249 -820 4 2 3 1 62 114 61 184 -821 4 2 3 1 65 64 185 143 -822 4 2 3 1 183 91 59 58 -823 4 2 3 1 94 57 187 201 -824 4 2 3 1 152 22 21 244 -825 4 2 3 1 192 62 100 116 -826 4 2 3 1 33 198 190 2 -827 4 2 3 1 55 56 168 182 -828 4 2 3 1 62 192 100 184 -829 4 2 3 1 97 81 89 251 -830 4 2 3 1 32 31 84 250 -831 4 2 3 1 124 130 129 248 -832 4 2 3 1 192 53 4 116 -833 4 2 3 1 95 33 190 2 -834 4 2 3 1 156 160 36 241 -835 4 2 3 1 177 195 194 243 -836 4 2 3 1 199 173 3 14 -837 4 2 3 1 33 198 2 117 -838 4 2 3 1 54 186 168 173 -839 4 2 3 1 198 60 2 117 -840 4 2 3 1 114 60 188 117 -841 4 2 3 1 82 84 80 246 -842 4 2 3 1 47 115 48 242 -843 4 2 3 1 54 199 173 3 -844 4 2 3 1 106 123 111 249 -845 4 2 3 1 91 94 57 187 -846 4 2 3 1 23 1 44 247 -847 4 2 3 1 121 31 122 250 -848 4 2 3 1 61 114 188 184 -849 4 2 3 1 186 55 168 182 -850 4 2 3 1 115 120 48 242 -851 4 2 3 1 124 128 130 248 -852 4 2 3 1 178 194 195 243 -853 4 2 3 1 22 152 154 244 -854 4 2 3 1 223 245 228 254 -855 4 2 3 1 25 26 99 239 -856 4 2 3 1 244 247 225 255 -857 4 2 3 1 94 57 201 5 -858 4 2 3 1 81 79 89 251 -859 4 2 3 1 160 35 36 241 -860 4 2 3 1 196 179 197 252 -861 4 2 3 1 140 44 45 247 -862 4 2 3 1 200 192 53 4 -863 4 2 3 1 34 94 201 5 -864 4 2 3 1 183 91 58 187 -865 4 2 3 1 140 23 44 247 -866 4 2 3 1 64 189 185 143 -867 4 2 3 1 193 34 201 5 -868 4 2 3 1 78 42 92 255 -869 4 2 3 1 193 172 34 5 -870 4 2 3 1 147 200 53 4 -871 4 2 3 1 82 77 84 246 -872 4 2 3 1 27 76 90 253 -873 4 2 3 1 63 189 143 147 -874 4 2 3 1 189 63 200 147 -875 4 2 3 1 63 200 147 4 -876 4 2 3 1 197 177 196 252 -877 4 2 3 1 31 32 122 250 -878 4 2 3 1 186 55 54 168 -879 4 2 3 1 61 114 60 188 -880 4 2 3 1 59 95 190 2 -881 4 2 3 1 191 65 146 3 -882 4 2 3 1 62 192 4 116 -883 4 2 3 1 58 91 57 187 -884 4 2 3 1 28 27 90 253 -885 4 2 3 1 189 64 63 143 -886 4 2 3 1 193 56 172 5 -887 4 2 3 1 150 235 245 161 -888 4 2 3 1 245 235 150 228 -889 4 2 3 1 142 236 233 242 -890 4 2 3 1 19 159 223 18 -891 4 2 3 1 223 159 19 228 -892 4 2 3 1 135 19 223 18 -893 4 2 3 1 135 223 19 236 -894 4 2 3 1 241 252 181 231 -895 4 2 3 1 181 252 241 229 -896 4 2 3 1 252 241 254 220 -897 4 2 3 1 252 254 241 229 -898 4 2 3 1 139 142 236 125 -899 4 2 3 1 232 147 143 189 -900 4 2 3 1 232 143 147 137 -901 4 2 3 1 86 239 234 76 -902 4 2 3 1 86 234 239 255 -903 4 2 3 1 87 86 234 76 -904 4 2 3 1 87 234 86 255 -905 4 2 3 1 228 233 222 221 -906 4 2 3 1 228 222 233 236 -907 4 2 3 1 223 228 222 221 -908 4 2 3 1 223 222 228 236 -909 4 2 3 1 19 131 228 20 -910 4 2 3 1 228 131 19 236 -911 4 2 3 1 131 138 228 20 -912 4 2 3 1 228 138 131 236 -913 4 2 3 1 242 139 236 222 -914 4 2 3 1 242 236 139 142 -915 4 2 3 1 124 135 223 144 -916 4 2 3 1 223 135 124 236 -917 4 2 3 1 240 100 105 107 -918 4 2 3 1 240 105 100 227 -919 4 2 3 1 103 240 105 107 -920 4 2 3 1 103 105 240 227 -921 4 2 3 1 221 223 220 222 -922 4 2 3 1 221 220 223 254 -923 4 2 3 1 118 242 222 49 -924 4 2 3 1 222 242 118 237 -925 4 2 3 1 118 222 50 49 -926 4 2 3 1 227 100 114 105 -927 4 2 3 1 227 114 100 184 -928 4 2 3 1 223 159 171 18 -929 4 2 3 1 223 171 159 245 -930 4 2 3 1 234 90 74 79 -931 4 2 3 1 234 74 90 253 -932 4 2 3 1 251 234 74 79 -933 4 2 3 1 29 226 74 93 -934 4 2 3 1 29 74 226 253 -935 4 2 3 1 129 238 132 133 -936 4 2 3 1 132 238 129 248 -937 4 2 3 1 138 228 233 236 -938 4 2 3 1 138 233 228 244 -939 4 2 3 1 223 129 124 144 -940 4 2 3 1 223 124 129 248 -941 4 2 3 1 246 95 183 77 -942 4 2 3 1 246 183 95 190 -943 4 2 3 1 183 95 59 77 -944 4 2 3 1 183 59 95 190 -945 4 2 3 1 229 223 170 238 -946 4 2 3 1 170 223 229 245 -947 4 2 3 1 31 226 249 30 -948 4 2 3 1 31 249 226 250 -949 4 2 3 1 121 31 249 30 -950 4 2 3 1 121 249 31 250 -951 4 2 3 1 183 231 91 187 -952 4 2 3 1 183 91 231 246 -953 4 2 3 1 235 245 254 228 -954 4 2 3 1 254 245 235 224 -955 4 2 3 1 168 229 153 175 -956 4 2 3 1 153 229 168 182 -957 4 2 3 1 110 109 230 98 -958 4 2 3 1 110 230 109 239 -959 4 2 3 1 152 165 235 151 -960 4 2 3 1 235 165 152 244 -961 4 2 3 1 152 235 162 151 -962 4 2 3 1 162 235 152 244 -963 4 2 3 1 241 251 220 231 -964 4 2 3 1 220 251 241 224 -965 4 2 3 1 113 249 253 106 -966 4 2 3 1 253 249 113 230 -967 4 2 3 1 255 247 239 24 -968 4 2 3 1 255 239 247 225 -969 4 2 3 1 226 234 74 251 -970 4 2 3 1 74 234 226 253 -971 4 2 3 1 109 242 98 115 -972 4 2 3 1 98 242 109 230 -973 4 2 3 1 47 115 233 46 -974 4 2 3 1 47 233 115 242 -975 4 2 3 1 233 115 109 46 -976 4 2 3 1 233 109 115 242 -977 4 2 3 1 251 82 80 246 -978 4 2 3 1 251 80 82 81 -979 4 2 3 1 33 84 250 32 -980 4 2 3 1 33 250 84 246 -981 4 2 3 1 233 239 221 225 -982 4 2 3 1 221 239 233 230 -983 4 2 3 1 246 85 251 82 -984 4 2 3 1 246 251 85 231 -985 4 2 3 1 247 154 22 23 -986 4 2 3 1 247 22 154 244 -987 4 2 3 1 88 83 224 39 -988 4 2 3 1 88 224 83 234 -989 4 2 3 1 235 88 224 39 -990 4 2 3 1 235 224 88 234 -991 4 2 3 1 221 226 237 220 -992 4 2 3 1 237 226 221 230 -993 4 2 3 1 221 237 222 220 -994 4 2 3 1 222 237 221 230 -995 4 2 3 1 34 231 193 201 -996 4 2 3 1 34 193 231 241 -997 4 2 3 1 193 231 181 201 -998 4 2 3 1 193 181 231 241 -999 4 2 3 1 37 224 89 38 -1000 4 2 3 1 89 224 83 38 -1001 4 2 3 1 89 83 224 251 -1002 4 2 3 1 142 136 236 125 -1003 4 2 3 1 142 236 136 233 -1004 4 2 3 1 236 136 126 125 -1005 4 2 3 1 236 139 248 222 -1006 4 2 3 1 236 248 139 128 -1007 4 2 3 1 248 139 141 222 -1008 4 2 3 1 248 141 139 128 -1009 4 2 3 1 140 22 233 138 -1010 4 2 3 1 140 233 22 247 -1011 4 2 3 1 233 22 244 138 -1012 4 2 3 1 233 244 22 247 -1013 4 2 3 1 138 236 136 126 -1014 4 2 3 1 136 236 138 233 -1015 4 2 3 1 226 31 246 80 -1016 4 2 3 1 226 246 31 250 -1017 4 2 3 1 246 31 84 80 -1018 4 2 3 1 246 84 31 250 -1019 4 2 3 1 220 251 221 226 -1020 4 2 3 1 220 221 251 224 -1021 4 2 3 1 221 251 234 226 -1022 4 2 3 1 221 234 251 224 -1023 4 2 3 1 237 240 220 227 -1024 4 2 3 1 220 240 237 222 -1025 4 2 3 1 240 232 220 227 -1026 4 2 3 1 220 232 240 222 -1027 4 2 3 1 252 181 194 177 -1028 4 2 3 1 252 194 181 231 -1029 4 2 3 1 243 252 194 177 -1030 4 2 3 1 243 194 252 231 -1031 4 2 3 1 170 16 223 17 -1032 4 2 3 1 223 16 170 238 -1033 4 2 3 1 16 129 223 17 -1034 4 2 3 1 223 129 16 238 -1035 4 2 3 1 3 191 14 146 -1036 4 2 3 1 14 191 3 199 -1037 4 2 3 1 191 238 14 146 -1038 4 2 3 1 14 238 191 199 -1039 4 2 3 1 118 222 240 50 -1040 4 2 3 1 118 240 222 237 -1041 4 2 3 1 103 118 240 50 -1042 4 2 3 1 103 240 118 237 -1043 4 2 3 1 224 89 97 37 -1044 4 2 3 1 224 97 89 251 -1045 4 2 3 1 241 224 97 37 -1046 4 2 3 1 241 97 224 251 -1047 4 2 4 2 202 215 206 219 -1048 4 2 4 2 215 203 202 206 -1049 4 2 4 2 219 206 214 216 -1050 4 2 4 2 206 204 219 214 -1051 4 2 4 2 218 205 212 204 -1052 4 2 4 2 202 206 204 219 -1053 4 2 4 2 215 206 219 216 -1054 4 2 4 2 205 218 202 204 -1055 4 2 4 2 210 217 218 71 -1056 4 2 4 2 205 210 68 203 -1057 4 2 4 2 204 206 66 214 -1058 4 2 4 2 73 219 214 216 -1059 4 2 4 2 208 67 203 206 -1060 4 2 4 2 205 69 212 204 -1061 4 2 4 2 210 6 68 203 -1062 4 2 4 2 10 208 70 216 -1063 4 2 4 2 66 204 214 7 -1064 4 2 4 2 8 205 69 212 -1065 4 2 4 2 208 9 67 206 -1066 4 2 4 2 73 219 13 214 -1067 4 2 4 2 217 210 11 71 -1068 4 2 4 2 218 12 72 212 -1069 4 2 4 2 73 10 216 213 -1070 4 2 4 2 8 205 209 68 -1071 4 2 4 2 206 9 66 213 -1072 4 2 4 2 207 217 11 70 -1073 4 2 4 2 6 207 67 203 -1074 4 2 4 2 204 69 211 7 -1075 4 2 4 2 202 219 218 215 -1076 4 2 4 2 218 219 202 204 -1077 4 2 4 2 202 218 203 215 -1078 4 2 4 2 202 203 218 205 -1079 4 2 4 2 203 218 217 215 -1080 4 2 4 2 215 203 216 217 -1081 4 2 4 2 216 203 215 206 -1082 4 2 4 2 216 208 203 206 -1083 4 2 4 2 7 13 204 214 -1084 4 2 4 2 7 204 13 211 -1085 4 2 4 2 204 13 219 214 -1086 4 2 4 2 9 10 216 208 -1087 4 2 4 2 9 216 10 213 -1088 4 2 4 2 206 9 216 208 -1089 4 2 4 2 206 216 9 213 -1090 4 2 4 2 12 8 205 209 -1091 4 2 4 2 12 205 8 212 -1092 4 2 4 2 218 205 12 212 -1093 4 2 4 2 11 6 203 207 -1094 4 2 4 2 11 203 6 210 -1095 4 2 4 2 217 11 203 207 -1096 4 2 4 2 217 203 11 210 -1097 4 2 4 2 72 69 204 212 -1098 4 2 4 2 72 204 69 211 -1099 4 2 4 2 73 66 216 214 -1100 4 2 4 2 73 216 66 213 -1101 4 2 4 2 216 66 206 214 -1102 4 2 4 2 216 206 66 213 -1103 4 2 4 2 71 68 205 210 -1104 4 2 4 2 71 205 68 209 -1105 4 2 4 2 218 71 205 210 -1106 4 2 4 2 70 67 203 208 -1107 4 2 4 2 70 203 67 207 -1108 4 2 4 2 217 203 70 207 -1109 4 2 4 2 203 218 210 217 -1110 4 2 4 2 210 218 203 205 -1111 4 2 4 2 204 13 72 219 -1112 4 2 4 2 72 13 204 211 -1113 4 2 4 2 205 12 71 218 -1114 4 2 4 2 205 71 12 209 -1115 4 2 4 2 204 72 218 219 -1116 4 2 4 2 204 218 72 212 -1117 4 2 4 2 203 70 216 217 -1118 4 2 4 2 203 216 70 208 -$EndElements diff --git a/extra_packages/contact_alejandro/test/material.dat b/extra_packages/contact_alejandro/test/material.dat deleted file mode 100644 index 8bbe418cd..000000000 --- a/extra_packages/contact_alejandro/test/material.dat +++ /dev/null @@ -1,14 +0,0 @@ -material neohookean [ - name = Top_body - E = 1 - nu = 0.3 - finite_deformation = 1 -] - - -material neohookean [ - name = Bottom_body - E = 10000 - nu = 0.3 - finite_deformation = 1 -] diff --git a/extra_packages/contact_alejandro/test/offset_1slave.cc b/extra_packages/contact_alejandro/test/offset_1slave.cc deleted file mode 100644 index 31add9b60..000000000 --- a/extra_packages/contact_alejandro/test/offset_1slave.cc +++ /dev/null @@ -1,103 +0,0 @@ -/** - * @file offset_1slave.cc - * - * @author Alejandro M. Aragón - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file tests the basic contact implementation using the - * generalized Newton method - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("steel.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("offset_1slave.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - // initialize material - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addArea(4, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()< - * - * @date creation: Mon Sep 15 2014 - * @date last modification: Sun Oct 19 2014 - * - * @brief This file tests the basic contact implementation using the - * generalized Newton method - * - * @section LICENSE - * - * Copyright (©) 2014, 2015 EPFL (Ecole Polytechnique Fédérale de Lausanne) - * Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides) - * - * Akantu 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. - * - * Akantu 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 Akantu. If not, see . - * - */ - -#include "contact_impl.hh" - -using namespace akantu; - -using std::cout; -using std::endl; -using std::setw; -using std::setprecision; - -int main(int argc, char *argv[]) { - - // set dimension - static const UInt dim = 2; - - // type definitions - typedef SolidMechanicsModel model_type; - typedef Contact > - contact_type; - - initialize("steel.dat", argc, argv); - - // create meshes - Mesh mesh(dim); - - // read meshes - mesh.read("offset_2slaves.msh"); - - // create models - model_type model(mesh); - - SolidMechanicsModelOptions opt(_static); - - // initialize material - // initialize material - model.initFull(opt); - model.updateCurrentPosition(); - // create data structure that holds contact data - contact_type cd(argc, argv, model); - - // set Paraview output resluts - model.setBaseName("contact"); - model.addDumpFieldVector("displacement"); - - mesh.createGroupsFromMeshData("physical_names"); - - cd.addSlave(4); - cd.addArea(4, 1.0); - - // add master surface to find pairs - cd.searchSurface("Contact"); - - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Top"); - model.applyBC(BC::Dirichlet::FixedValue(0., _x), "Bottom"); - model.applyBC(BC::Dirichlet::FixedValue(0., _y), "Bottom"); - - Real U = 0.5; - Real Du = 0.01; - for (Real u = Du; u <= U; u += Du) { - - model.applyBC(BC::Dirichlet::FixedValue(-u, _y), "Top"); - - // solve contact step (no need to call solve on the model object) - solveContactStep<_generalized_newton>(cd); - } - - cout<<"Force: "<< cd.getForce()<