diff --git a/extra_packages/parallel-cohesive-element b/extra_packages/parallel-cohesive-element index 816a3f911..b0c3993cb 160000 --- a/extra_packages/parallel-cohesive-element +++ b/extra_packages/parallel-cohesive-element @@ -1 +1 @@ -Subproject commit 816a3f9116847551ae2041cab5d8be11ba6435e5 +Subproject commit b0c3993cb0951c1670a79fa8bbe41b908b8c7101 diff --git a/src/io/dumper/dumper_element_iterator.hh b/src/io/dumper/dumper_element_iterator.hh index 83a3945ac..d71c1064d 100644 --- a/src/io/dumper/dumper_element_iterator.hh +++ b/src/io/dumper/dumper_element_iterator.hh @@ -1,190 +1,193 @@ /** * @file dumper_element_iterator.hh * * @author Guillaume Anciaux * @author Nicolas Richart * * @date creation: Tue Sep 02 2014 * @date last modification: Wed Sep 03 2014 * * @brief Iterators for elemental fields * * @section LICENSE * * Copyright (©) 2014 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_DUMPER_ELEMENT_ITERATOR_HH__ #define __AKANTU_DUMPER_ELEMENT_ITERATOR_HH__ /* -------------------------------------------------------------------------- */ #include "element.hh" /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ __BEGIN_AKANTU_DUMPER__ /* -------------------------------------------------------------------------- */ template class final_iterator> class element_iterator { /* ------------------------------------------------------------------------ */ /* Typedefs */ /* ------------------------------------------------------------------------ */ public: typedef typename types::it_type it_type; typedef typename types::field_type field_type; typedef typename types::array_type array_type; typedef typename types::array_iterator array_iterator; typedef final_iterator iterator; public: /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ element_iterator(const field_type & field, const typename field_type::type_iterator & t_it, const typename field_type::type_iterator & t_it_end, const array_iterator & array_it, const array_iterator & array_it_end, const GhostType ghost_type = _not_ghost) : field(field), tit(t_it), tit_end(t_it_end), array_it(array_it), array_it_end(array_it_end), ghost_type(ghost_type) { } /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: bool operator!=(const iterator & it) const { return (ghost_type != it.ghost_type) || (tit != it.tit || (array_it != it.array_it)); } iterator & operator++() { ++array_it; while(array_it == array_it_end && tit != tit_end) { ++tit; if(tit != tit_end) { const array_type & vect = field(*tit, ghost_type); UInt _nb_data_per_elem = getNbDataPerElem(*tit); UInt nb_component = vect.getNbComponent(); UInt size = (vect.getSize() * nb_component) / _nb_data_per_elem; array_it = vect.begin_reinterpret(_nb_data_per_elem,size); array_it_end = vect.end_reinterpret (_nb_data_per_elem,size); } } return *(static_cast(this)); }; ElementType getType() { return *tit; } UInt element_type() { return getIOHelperType(*tit); } Element getCurrentElement(){ return Element(*tit,array_it.getCurrentIndex()); } UInt getNbDataPerElem(const ElementType & type) const { + if (!nb_data_per_elem.exists(type, ghost_type)) + return field(type,ghost_type).getNbComponent(); + return nb_data_per_elem(type,ghost_type); } void setNbDataPerElem(const ElementTypeMap & nb_data){ this->nb_data_per_elem = nb_data; } /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// the field to iterate on const field_type & field; /// field iterator typename field_type::type_iterator tit; /// field iterator end typename field_type::type_iterator tit_end; /// array iterator array_iterator array_it; /// internal iterator end array_iterator array_it_end; /// ghost type identification const GhostType ghost_type; /// number of data per element ElementTypeMap nb_data_per_elem; }; /* -------------------------------------------------------------------------- */ template class elemental_field_iterator : public element_iterator { public: /* ------------------------------------------------------------------------ */ /* Typedefs */ /* ------------------------------------------------------------------------ */ typedef element_iterator parent; typedef typename types::it_type it_type; typedef typename types::return_type return_type; typedef typename types::field_type field_type; typedef typename types::array_iterator array_iterator; public: /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ elemental_field_iterator(const field_type & field, const typename field_type::type_iterator & t_it, const typename field_type::type_iterator & t_it_end, const array_iterator & array_it, const array_iterator & array_it_end, const GhostType ghost_type = _not_ghost) : parent(field, t_it, t_it_end, array_it, array_it_end, ghost_type) { } /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ return_type operator*(){ return *this->array_it; } private: }; /* -------------------------------------------------------------------------- */ __END_AKANTU_DUMPER__ __END_AKANTU__ /* -------------------------------------------------------------------------- */ #endif /* __AKANTU_DUMPER_ELEMENT_ITERATOR_HH__ */ diff --git a/src/model/heat_transfer/heat_transfer_model.cc b/src/model/heat_transfer/heat_transfer_model.cc index 2fda3f8d2..ea6d30e59 100644 --- a/src/model/heat_transfer/heat_transfer_model.cc +++ b/src/model/heat_transfer/heat_transfer_model.cc @@ -1,952 +1,984 @@ /** * @file heat_transfer_model.cc * * @author Guillaume Anciaux * @author Lucas Frerot * @author Srinivasa Babu Ramisetti * @author David Simon Kammer * @author Nicolas Richart * @author Rui Wang * * @date creation: Sun May 01 2011 * @date last modification: Mon Sep 15 2014 * * @brief Implementation of HeatTransferModel class * * @section LICENSE * * Copyright (©) 2014 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 "heat_transfer_model.hh" #include "group_manager_inline_impl.cc" #include "dumpable_inline_impl.hh" #include "aka_math.hh" #include "aka_common.hh" #include "fe_engine_template.hh" #include "mesh.hh" #include "static_communicator.hh" #include "parser.hh" #include "generalized_trapezoidal.hh" #ifdef AKANTU_USE_MUMPS #include "solver_mumps.hh" #endif #ifdef AKANTU_USE_IOHELPER # include "dumper_paraview.hh" # include "dumper_elemental_field.hh" # include "dumper_element_partition.hh" # include "dumper_material_internal_field.hh" #endif /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ const HeatTransferModelOptions default_heat_transfer_model_options(_explicit_lumped_capacity); /* -------------------------------------------------------------------------- */ HeatTransferModel::HeatTransferModel(Mesh & mesh, UInt dim, const ID & id, const MemoryID & memory_id) : Model(mesh, dim, id, memory_id), Parsable(_st_heat, id), integrator(new ForwardEuler()), stiffness_matrix(NULL), jacobian_matrix(NULL), temperature_gradient ("temperature_gradient", id), temperature_on_qpoints ("temperature_on_qpoints", id), conductivity_on_qpoints ("conductivity_on_qpoints", id), k_gradt_on_qpoints ("k_gradt_on_qpoints", id), int_bt_k_gT ("int_bt_k_gT", id), bt_k_gT ("bt_k_gT", id), conductivity(spatial_dimension, spatial_dimension), thermal_energy ("thermal_energy", id) { AKANTU_DEBUG_IN(); createSynchronizerRegistry(this); std::stringstream sstr; sstr << id << ":fem"; registerFEEngineObject(sstr.str(), mesh,spatial_dimension); this->temperature= NULL; this->residual = NULL; this->blocked_dofs = NULL; #ifdef AKANTU_USE_IOHELPER this->mesh.registerDumper("paraview_all", id, true); this->mesh.addDumpMesh(mesh, spatial_dimension, _not_ghost, _ek_regular); #endif this->registerParam("conductivity" , conductivity , _pat_parsmod); this->registerParam("conductivity_variation", conductivity_variation, 0., _pat_parsmod); this->registerParam("temperature_reference" , T_ref , 0., _pat_parsmod); this->registerParam("capacity" , capacity , _pat_parsmod); this->registerParam("density" , density , _pat_parsmod); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initModel() { getFEEngine().initShapeFunctions(_not_ghost); getFEEngine().initShapeFunctions(_ghost); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initParallel(MeshPartition * partition, DataAccessor * data_accessor) { AKANTU_DEBUG_IN(); if (data_accessor == NULL) data_accessor = this; Synchronizer & synch_parallel = createParallelSynch(partition,data_accessor); synch_registry->registerSynchronizer(synch_parallel, _gst_htm_capacity); synch_registry->registerSynchronizer(synch_parallel, _gst_htm_temperature); synch_registry->registerSynchronizer(synch_parallel, _gst_htm_gradient_temperature); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initPBC() { AKANTU_DEBUG_IN(); Model::initPBC(); PBCSynchronizer * synch = new PBCSynchronizer(pbc_pair); synch_registry->registerSynchronizer(*synch, _gst_htm_capacity); synch_registry->registerSynchronizer(*synch, _gst_htm_temperature); changeLocalEquationNumberForPBC(pbc_pair,1); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initArrays() { AKANTU_DEBUG_IN(); UInt nb_nodes = getFEEngine().getMesh().getNbNodes(); std::stringstream sstr_temp; sstr_temp << Model::id << ":temperature"; std::stringstream sstr_temp_rate; sstr_temp_rate << Model::id << ":temperature_rate"; std::stringstream sstr_inc; sstr_inc << Model::id << ":increment"; std::stringstream sstr_ext_flx; sstr_ext_flx << Model::id << ":external_flux"; std::stringstream sstr_residual; sstr_residual << Model::id << ":residual"; std::stringstream sstr_lump; sstr_lump << Model::id << ":lumped"; std::stringstream sstr_boun; sstr_boun << Model::id << ":blocked_dofs"; temperature = &(alloc(sstr_temp.str(), nb_nodes, 1, REAL_INIT_VALUE)); temperature_rate = &(alloc(sstr_temp_rate.str(), nb_nodes, 1, REAL_INIT_VALUE)); increment = &(alloc(sstr_inc.str(), nb_nodes, 1, REAL_INIT_VALUE)); external_heat_rate = &(alloc(sstr_ext_flx.str(), nb_nodes, 1, REAL_INIT_VALUE)); residual = &(alloc(sstr_residual.str(), nb_nodes, 1, REAL_INIT_VALUE)); capacity_lumped = &(alloc(sstr_lump.str(), nb_nodes, 1, REAL_INIT_VALUE)); blocked_dofs = &(alloc(sstr_boun.str(), nb_nodes, 1, false)); Mesh::ConnectivityTypeList::const_iterator it; /* -------------------------------------------------------------------------- */ // byelementtype vectors getFEEngine().getMesh().initElementTypeMapArray(temperature_on_qpoints, 1, spatial_dimension); getFEEngine().getMesh().initElementTypeMapArray(temperature_gradient, spatial_dimension, spatial_dimension); getFEEngine().getMesh().initElementTypeMapArray(conductivity_on_qpoints, spatial_dimension*spatial_dimension, spatial_dimension); getFEEngine().getMesh().initElementTypeMapArray(k_gradt_on_qpoints, spatial_dimension, spatial_dimension); getFEEngine().getMesh().initElementTypeMapArray(bt_k_gT, 1, spatial_dimension,true); getFEEngine().getMesh().initElementTypeMapArray(int_bt_k_gT, 1, spatial_dimension,true); getFEEngine().getMesh().initElementTypeMapArray(thermal_energy, 1, spatial_dimension); for(UInt g = _not_ghost; g <= _ghost; ++g) { GhostType gt = (GhostType) g; const Mesh::ConnectivityTypeList & type_list = getFEEngine().getMesh().getConnectivityTypeList(gt); for(it = type_list.begin(); it != type_list.end(); ++it) { if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue; UInt nb_element = getFEEngine().getMesh().getNbElement(*it, gt); UInt nb_quad_points = this->getFEEngine().getNbQuadraturePoints(*it, gt) * nb_element; temperature_on_qpoints(*it, gt).resize(nb_quad_points); temperature_on_qpoints(*it, gt).clear(); temperature_gradient(*it, gt).resize(nb_quad_points); temperature_gradient(*it, gt).clear(); conductivity_on_qpoints(*it, gt).resize(nb_quad_points); conductivity_on_qpoints(*it, gt).clear(); k_gradt_on_qpoints(*it, gt).resize(nb_quad_points); k_gradt_on_qpoints(*it, gt).clear(); bt_k_gT(*it, gt).resize(nb_quad_points); bt_k_gT(*it, gt).clear(); int_bt_k_gT(*it, gt).resize(nb_element); int_bt_k_gT(*it, gt).clear(); thermal_energy(*it, gt).resize(nb_element); thermal_energy(*it, gt).clear(); } } /* -------------------------------------------------------------------------- */ dof_synchronizer = new DOFSynchronizer(getFEEngine().getMesh(),1); dof_synchronizer->initLocalDOFEquationNumbers(); dof_synchronizer->initGlobalDOFEquationNumbers(); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initSolver(__attribute__((unused)) SolverOptions & options) { #if !defined(AKANTU_USE_MUMPS) // or other solver in the future \todo add AKANTU_HAS_SOLVER in CMake AKANTU_DEBUG_ERROR("You should at least activate one solver."); #else UInt nb_global_nodes = mesh.getNbGlobalNodes(); delete jacobian_matrix; std::stringstream sstr; sstr << Memory::id << ":jacobian_matrix"; jacobian_matrix = new SparseMatrix(nb_global_nodes, _symmetric, sstr.str(), memory_id); jacobian_matrix->buildProfile(mesh, *dof_synchronizer, 1); delete stiffness_matrix; std::stringstream sstr_sti; sstr_sti << Memory::id << ":stiffness_matrix"; stiffness_matrix = new SparseMatrix(*jacobian_matrix, sstr_sti.str(), memory_id); #ifdef AKANTU_USE_MUMPS std::stringstream sstr_solv; sstr_solv << Memory::id << ":solver"; solver = new SolverMumps(*jacobian_matrix, sstr_solv.str()); dof_synchronizer->initScatterGatherCommunicationScheme(); #else AKANTU_DEBUG_ERROR("You should at least activate one solver."); #endif //AKANTU_USE_MUMPS if(solver) solver->initialize(options); #endif //AKANTU_HAS_SOLVER } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initImplicit(SolverOptions & solver_options) { method = _static; initSolver(solver_options); } /* -------------------------------------------------------------------------- */ HeatTransferModel::~HeatTransferModel() { AKANTU_DEBUG_IN(); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::assembleCapacityLumped(const GhostType & ghost_type) { AKANTU_DEBUG_IN(); FEEngine & fem = getFEEngine(); const Mesh::ConnectivityTypeList & type_list = fem.getMesh().getConnectivityTypeList(ghost_type); Mesh::ConnectivityTypeList::const_iterator it; for(it = type_list.begin(); it != type_list.end(); ++it) { if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue; UInt nb_element = getFEEngine().getMesh().getNbElement(*it,ghost_type); UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(*it, ghost_type); Array rho_1 (nb_element * nb_quadrature_points,1, capacity * density); fem.assembleFieldLumped(rho_1,1,*capacity_lumped, dof_synchronizer->getLocalDOFEquationNumbers(), *it, ghost_type); } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::assembleCapacityLumped() { AKANTU_DEBUG_IN(); capacity_lumped->clear(); assembleCapacityLumped(_not_ghost); assembleCapacityLumped(_ghost); getSynchronizerRegistry().synchronize(_gst_htm_capacity); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::updateResidual() { AKANTU_DEBUG_IN(); /// @f$ r = q_{ext} - q_{int} - C \dot T @f$ // start synchronization synch_registry->asynchronousSynchronize(_gst_htm_temperature); // finalize communications synch_registry->waitEndSynchronize(_gst_htm_temperature); //clear the array /// first @f$ r = q_{ext} @f$ // residual->clear(); residual->copy(*external_heat_rate); /// then @f$ r -= q_{int} @f$ // update the not ghost ones updateResidual(_not_ghost); // update for the received ghosts updateResidual(_ghost); /* if (method == _explicit_lumped_capacity) { this->solveExplicitLumped(); }*/ AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::assembleStiffnessMatrix() { AKANTU_DEBUG_IN(); AKANTU_DEBUG_INFO("Assemble the new stiffness matrix."); stiffness_matrix->clear(); switch(mesh.getSpatialDimension()) { case 1: this->assembleStiffnessMatrix<1>(_not_ghost); break; case 2: this->assembleStiffnessMatrix<2>(_not_ghost); break; case 3: this->assembleStiffnessMatrix<3>(_not_ghost); break; } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void HeatTransferModel::assembleStiffnessMatrix(const GhostType & ghost_type) { AKANTU_DEBUG_IN(); Mesh & mesh = this->getFEEngine().getMesh(); Mesh::type_iterator it = mesh.firstType(spatial_dimension, ghost_type); Mesh::type_iterator last_type = mesh.lastType(spatial_dimension, ghost_type); for(; it != last_type; ++it) { this->assembleStiffnessMatrix(*it, ghost_type); } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template void HeatTransferModel::assembleStiffnessMatrix(const ElementType & type, const GhostType & ghost_type) { AKANTU_DEBUG_IN(); SparseMatrix & K = *stiffness_matrix; const Array & shapes_derivatives = this->getFEEngine().getShapesDerivatives(type, ghost_type); UInt nb_element = mesh.getNbElement(type, ghost_type); UInt nb_nodes_per_element = Mesh::getNbNodesPerElement(type); UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(type, ghost_type); /// compute @f$\mathbf{B}^t * \mathbf{D} * \mathbf{B}@f$ UInt bt_d_b_size = nb_nodes_per_element; Array * bt_d_b = new Array(nb_element * nb_quadrature_points, bt_d_b_size * bt_d_b_size, "B^t*D*B"); Matrix Bt_D(nb_nodes_per_element, dim); Array::const_iterator< Matrix > shapes_derivatives_it = shapes_derivatives.begin(dim, nb_nodes_per_element); Array::iterator< Matrix > Bt_D_B_it = bt_d_b->begin(bt_d_b_size, bt_d_b_size); this->computeConductivityOnQuadPoints(ghost_type); Array::iterator< Matrix > D_it = conductivity_on_qpoints(type, ghost_type).begin(dim, dim); Array::iterator< Matrix > D_end = conductivity_on_qpoints(type, ghost_type).end(dim, dim); for (; D_it != D_end; ++D_it, ++Bt_D_B_it, ++shapes_derivatives_it) { Matrix & D = *D_it; const Matrix & B = *shapes_derivatives_it; Matrix & Bt_D_B = *Bt_D_B_it; Bt_D.mul(B, D); Bt_D_B.mul(Bt_D, B); } /// compute @f$ k_e = \int_e \mathbf{B}^t * \mathbf{D} * \mathbf{B}@f$ Array * K_e = new Array(nb_element, bt_d_b_size * bt_d_b_size, "K_e"); this->getFEEngine().integrate(*bt_d_b, *K_e, bt_d_b_size * bt_d_b_size, type, ghost_type); delete bt_d_b; this->getFEEngine().assembleMatrix(*K_e, K, 1, type, ghost_type); delete K_e; AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::solveStatic() { AKANTU_DEBUG_IN(); AKANTU_DEBUG_INFO("Solving Ku = f"); AKANTU_DEBUG_ASSERT(stiffness_matrix != NULL, "You should first initialize the implicit solver and assemble the stiffness matrix"); UInt nb_nodes = temperature->getSize(); UInt nb_degree_of_freedom = temperature->getNbComponent() * nb_nodes; jacobian_matrix->copyContent(*stiffness_matrix); jacobian_matrix->applyBoundary(*blocked_dofs); increment->clear(); solver->setRHS(*residual); solver->factorize(); solver->solve(*increment); Real * increment_val = increment->storage(); Real * temperature_val = temperature->storage(); bool * blocked_dofs_val = blocked_dofs->storage(); for (UInt j = 0; j < nb_degree_of_freedom; ++j, ++temperature_val, ++increment_val, ++blocked_dofs_val) { if (!(*blocked_dofs_val)) { *temperature_val += *increment_val; } else { *increment_val = 0.0; } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::computeConductivityOnQuadPoints(const GhostType & ghost_type) { const Mesh::ConnectivityTypeList & type_list = this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type); Mesh::ConnectivityTypeList::const_iterator it; for(it = type_list.begin(); it != type_list.end(); ++it) { if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue; Array & temperature_interpolated = temperature_on_qpoints(*it, ghost_type); //compute the temperature on quadrature points this->getFEEngine().interpolateOnQuadraturePoints(*temperature, temperature_interpolated, 1 ,*it,ghost_type); Array::matrix_iterator C_it = conductivity_on_qpoints(*it, ghost_type).begin(spatial_dimension, spatial_dimension); Array::matrix_iterator C_end = conductivity_on_qpoints(*it, ghost_type).end(spatial_dimension, spatial_dimension); Array::iterator T_it = temperature_interpolated.begin(); for (;C_it != C_end; ++C_it, ++T_it) { Matrix & C = *C_it; Real & T = *T_it; C = conductivity; Matrix variation(spatial_dimension, spatial_dimension, conductivity_variation * (T - T_ref)); C += conductivity_variation; } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::computeKgradT(const GhostType & ghost_type) { computeConductivityOnQuadPoints(ghost_type); const Mesh::ConnectivityTypeList & type_list = this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type); Mesh::ConnectivityTypeList::const_iterator it; for(it = type_list.begin(); it != type_list.end(); ++it) { const ElementType & type = *it; if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue; Array & gradient = temperature_gradient(*it, ghost_type); this->getFEEngine().gradientOnQuadraturePoints(*temperature, gradient, 1 ,*it, ghost_type); Array::matrix_iterator C_it = conductivity_on_qpoints(*it, ghost_type).begin(spatial_dimension, spatial_dimension); Array::vector_iterator BT_it = gradient.begin(spatial_dimension); Array::vector_iterator k_BT_it = k_gradt_on_qpoints(type, ghost_type).begin(spatial_dimension); Array::vector_iterator k_BT_end = k_gradt_on_qpoints(type, ghost_type).end(spatial_dimension); for (;k_BT_it != k_BT_end; ++k_BT_it, ++BT_it, ++C_it) { Vector & k_BT = *k_BT_it; Vector & BT = *BT_it; Matrix & C = *C_it; k_BT.mul(C, BT); } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::updateResidual(const GhostType & ghost_type) { AKANTU_DEBUG_IN(); const Mesh::ConnectivityTypeList & type_list = this->getFEEngine().getMesh().getConnectivityTypeList(ghost_type); Mesh::ConnectivityTypeList::const_iterator it; for(it = type_list.begin(); it != type_list.end(); ++it) { if(Mesh::getSpatialDimension(*it) != spatial_dimension) continue; Array & shapes_derivatives = const_cast &>(getFEEngine().getShapesDerivatives(*it,ghost_type)); UInt nb_nodes_per_element = Mesh::getNbNodesPerElement(*it); // compute k \grad T computeKgradT(ghost_type); Array::vector_iterator k_BT_it = k_gradt_on_qpoints(*it,ghost_type).begin(spatial_dimension); Array::matrix_iterator B_it = shapes_derivatives.begin(spatial_dimension, nb_nodes_per_element); Array::vector_iterator Bt_k_BT_it = bt_k_gT(*it,ghost_type).begin(nb_nodes_per_element); Array::vector_iterator Bt_k_BT_end = bt_k_gT(*it,ghost_type).end(nb_nodes_per_element); for (;Bt_k_BT_it != Bt_k_BT_end; ++Bt_k_BT_it, ++B_it, ++k_BT_it) { Vector & k_BT = *k_BT_it; Vector & Bt_k_BT = *Bt_k_BT_it; Matrix & B = *B_it; Bt_k_BT.mul(B, k_BT); } this->getFEEngine().integrate(bt_k_gT(*it,ghost_type), int_bt_k_gT(*it,ghost_type), nb_nodes_per_element, *it,ghost_type); this->getFEEngine().assembleArray(int_bt_k_gT(*it,ghost_type), *residual, dof_synchronizer->getLocalDOFEquationNumbers(), 1, *it,ghost_type, empty_filter, -1); } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::solveExplicitLumped() { AKANTU_DEBUG_IN(); /// finally @f$ r -= C \dot T @f$ // lumped C UInt nb_nodes = temperature_rate->getSize(); UInt nb_degree_of_freedom = temperature_rate->getNbComponent(); Real * capacity_val = capacity_lumped->storage(); Real * temp_rate_val = temperature_rate->storage(); Real * res_val = residual->storage(); bool * blocked_dofs_val = blocked_dofs->storage(); for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) { if(!(*blocked_dofs_val)) { *res_val -= *capacity_val * *temp_rate_val; } blocked_dofs_val++; res_val++; capacity_val++; temp_rate_val++; } #ifndef AKANTU_NDEBUG getSynchronizerRegistry().synchronize(akantu::_gst_htm_gradient_temperature); #endif capacity_val = capacity_lumped->storage(); res_val = residual->storage(); blocked_dofs_val = blocked_dofs->storage(); Real * inc = increment->storage(); for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n) { if(!(*blocked_dofs_val)) { *inc = (*res_val / *capacity_val); } res_val++; blocked_dofs_val++; inc++; capacity_val++; } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::explicitPred() { AKANTU_DEBUG_IN(); integrator->integrationSchemePred(time_step, *temperature, *temperature_rate, *blocked_dofs); UInt nb_nodes = temperature->getSize(); UInt nb_degree_of_freedom = temperature->getNbComponent(); Real * temp = temperature->storage(); for (UInt n = 0; n < nb_nodes * nb_degree_of_freedom; ++n, ++temp) if(*temp < 0.) *temp = 0.; AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::explicitCorr() { AKANTU_DEBUG_IN(); integrator->integrationSchemeCorrTempRate(time_step, *temperature, *temperature_rate, *blocked_dofs, *increment); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::getStableTimeStep() { AKANTU_DEBUG_IN(); Real el_size; Real min_el_size = std::numeric_limits::max(); Real conductivitymax = conductivity(0, 0); //get the biggest parameter from k11 until k33// for(UInt i = 0; i < spatial_dimension; i++) for(UInt j = 0; j < spatial_dimension; j++) conductivitymax = std::max(conductivity(i, j), conductivitymax); const Mesh::ConnectivityTypeList & type_list = getFEEngine().getMesh().getConnectivityTypeList(); Mesh::ConnectivityTypeList::const_iterator it; for(it = type_list.begin(); it != type_list.end(); ++it) { if(getFEEngine().getMesh().getSpatialDimension(*it) != spatial_dimension) continue; UInt nb_nodes_per_element = getFEEngine().getMesh().getNbNodesPerElement(*it); Array coord(0, nb_nodes_per_element*spatial_dimension); FEEngine::extractNodalToElementField(getFEEngine().getMesh(), getFEEngine().getMesh().getNodes(), coord, *it, _not_ghost); Array::matrix_iterator el_coord = coord.begin(spatial_dimension, nb_nodes_per_element); UInt nb_element = getFEEngine().getMesh().getNbElement(*it); for (UInt el = 0; el < nb_element; ++el, ++el_coord) { el_size = getFEEngine().getElementInradius(*el_coord, *it); min_el_size = std::min(min_el_size, el_size); } AKANTU_DEBUG_INFO("The minimum element size : " << min_el_size << " and the max conductivity is : " << conductivitymax); } Real min_dt = 2 * min_el_size * min_el_size * density * capacity / conductivitymax; StaticCommunicator::getStaticCommunicator().allReduce(&min_dt, 1, _so_min); AKANTU_DEBUG_OUT(); return min_dt; } /* -------------------------------------------------------------------------- */ void HeatTransferModel::readMaterials() { std::pair sub_sect = this->parser->getSubSections(_st_heat); Parser::const_section_iterator it = sub_sect.first; const ParserSection & section = *it; this->parseSection(section); } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initFull(const ModelOptions & options){ Model::initFull(options); readMaterials(); const HeatTransferModelOptions & my_options = dynamic_cast(options); //initialize the vectors initArrays(); temperature->clear(); temperature_rate->clear(); external_heat_rate->clear(); method = my_options.analysis_method; if (method == _static) { initImplicit(); } } /* -------------------------------------------------------------------------- */ void HeatTransferModel::initFEEngineBoundary(bool create_surface) { if(create_surface) MeshUtils::buildFacets(getFEEngine().getMesh()); FEEngine & fem_boundary = getFEEngineBoundary(); fem_boundary.initShapeFunctions(); fem_boundary.computeNormalsOnControlPoints(); } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::computeThermalEnergyByNode() { AKANTU_DEBUG_IN(); Real ethermal = 0.; Array::vector_iterator heat_rate_it = residual->begin(residual->getNbComponent()); Array::vector_iterator heat_rate_end = residual->end(residual->getNbComponent()); UInt n = 0; for(;heat_rate_it != heat_rate_end; ++heat_rate_it, ++n) { Real heat = 0; bool is_local_node = mesh.isLocalOrMasterNode(n); bool is_not_pbc_slave_node = !isPBCSlaveNode(n); bool count_node = is_local_node && is_not_pbc_slave_node; Vector & heat_rate = *heat_rate_it; for (UInt i = 0; i < heat_rate.size(); ++i) { if (count_node) heat += heat_rate[i] * time_step; } ethermal += heat; } StaticCommunicator::getStaticCommunicator().allReduce(ðermal, 1, _so_sum); AKANTU_DEBUG_OUT(); return ethermal; } /* -------------------------------------------------------------------------- */ template void HeatTransferModel::getThermalEnergy(iterator Eth, Array::const_iterator T_it, Array::const_iterator T_end) const { for(;T_it != T_end; ++T_it, ++Eth) { *Eth = capacity * density * *T_it; } } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::getThermalEnergy(const ElementType & type, UInt index) { AKANTU_DEBUG_IN(); UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(type); Vector Eth_on_quarature_points(nb_quadrature_points); Array::iterator T_it = this->temperature_on_qpoints(type).begin(); T_it += index * nb_quadrature_points; Array::iterator T_end = T_it + nb_quadrature_points; getThermalEnergy(Eth_on_quarature_points.storage(), T_it, T_end); return getFEEngine().integrate(Eth_on_quarature_points, type, index); } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::getThermalEnergy() { Real Eth = 0; Mesh & mesh = getFEEngine().getMesh(); Mesh::type_iterator it = mesh.firstType(spatial_dimension); Mesh::type_iterator last_type = mesh.lastType(spatial_dimension); for(; it != last_type; ++it) { UInt nb_element = getFEEngine().getMesh().getNbElement(*it, _not_ghost); UInt nb_quadrature_points = getFEEngine().getNbQuadraturePoints(*it, _not_ghost); Array Eth_per_quad(nb_element * nb_quadrature_points, 1); Array::iterator T_it = this->temperature_on_qpoints(*it).begin(); Array::iterator T_end = this->temperature_on_qpoints(*it).end(); getThermalEnergy(Eth_per_quad.begin(), T_it, T_end); Eth += getFEEngine().integrate(Eth_per_quad, *it); } return Eth; } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::getEnergy(const std::string & id) { AKANTU_DEBUG_IN(); Real energy = 0; if("thermal") energy = getThermalEnergy(); // reduction sum over all processors StaticCommunicator::getStaticCommunicator().allReduce(&energy, 1, _so_sum); AKANTU_DEBUG_OUT(); return energy; } /* -------------------------------------------------------------------------- */ Real HeatTransferModel::getEnergy(const std::string & energy_id, const ElementType & type, UInt index) { AKANTU_DEBUG_IN(); Real energy = 0.; if("thermal") energy = getThermalEnergy(type, index); AKANTU_DEBUG_OUT(); return energy; } /* -------------------------------------------------------------------------- */ +/* -------------------------------------------------------------------------- */ +#ifdef AKANTU_USE_IOHELPER + dumper::Field * HeatTransferModel::createNodalFieldBool(const std::string & field_name, const std::string & group_name, bool padding_flag) { std::map* > uint_nodal_fields; uint_nodal_fields["blocked_dofs" ] = blocked_dofs; dumper::Field * field = NULL; field = mesh.createNodalField(uint_nodal_fields[field_name],group_name); return field; } /* -------------------------------------------------------------------------- */ dumper::Field * HeatTransferModel::createNodalFieldReal(const std::string & field_name, const std::string & group_name, bool padding_flag) { std::map* > real_nodal_fields; real_nodal_fields["temperature" ] = temperature; real_nodal_fields["temperature_rate" ] = temperature_rate; real_nodal_fields["external_heat_rate" ] = external_heat_rate; real_nodal_fields["residual" ] = residual; real_nodal_fields["capacity_lumped" ] = capacity_lumped; dumper::Field * field = mesh.createNodalField(real_nodal_fields[field_name],group_name); return field; } + /* -------------------------------------------------------------------------- */ + dumper::Field * HeatTransferModel ::createElementalField(const std::string & field_name, const std::string & group_name, bool padding_flag, const ElementKind & element_kind){ dumper::Field * field = NULL; if(field_name == "partitions") field = mesh.createElementalField(mesh.getConnectivities(),group_name,this->spatial_dimension,element_kind); else if(field_name == "temperature_gradient"){ ElementTypeMap nb_data_per_elem = this->mesh.getNbDataPerElem(temperature_gradient,element_kind); field = mesh.createElementalField(temperature_gradient, group_name, this->spatial_dimension, element_kind, nb_data_per_elem); } return field; } +/* -------------------------------------------------------------------------- */ +#else +/* -------------------------------------------------------------------------- */ +dumper::Field * HeatTransferModel +::createElementalField(const std::string & field_name, + const std::string & group_name, + bool padding_flag, + const ElementKind & element_kind){ + + return NULL; +} /* -------------------------------------------------------------------------- */ - - + +dumper::Field * HeatTransferModel::createNodalFieldBool(const std::string & field_name, + const std::string & group_name, + bool padding_flag) { + + return NULL; + +} +/* -------------------------------------------------------------------------- */ + +dumper::Field * HeatTransferModel::createNodalFieldReal(const std::string & field_name, + const std::string & group_name, + bool padding_flag) { + + return NULL; +} + +#endif __END_AKANTU__ diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index be0c5088a..09c9fcf25 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,88 +1,87 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # @author Alejandro M. Aragón # @author Nicolas Richart # # @date creation: Fri Sep 03 2010 # @date last modification: Thu Jul 03 2014 # # @brief configuration for tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 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 # #=============================================================================== include_directories( ${AKANTU_INCLUDE_DIRS} ${AKANTU_EXTERNAL_LIB_INCLUDE_DIR} ) set(AKANTU_TESTS_FILES CACHE INTERNAL "") #=============================================================================== # List of tests #=============================================================================== add_akantu_test(test_common "Test the common part of Akantu") add_akantu_test(test_static_memory "Test static memory") add_akantu_test(test_fem "Test finite element functionalties") add_akantu_test(test_mesh_utils "Test mesh utils") add_akantu_test(test_model "Test model objects") add_akantu_test(test_solver "Test solver function") add_akantu_test(test_io "Test the IO modules") add_akantu_test(test_contact "Test the contact part of Akantu") add_akantu_test(test_geometry "Test the geometry module of Akantu") -add_akantu_test(test_surface_extraction "Test mesh utils surface extraction") add_akantu_test(test_synchronizer "Test synchronizers") file(GLOB_RECURSE __all_files "*.*") set(_all_files) foreach(_file ${__all_files}) if("${_file}" MATCHES "${PROJECT_SOURCE_DIR}/test") file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_file}) list(APPEND _all_files ${__file}) endif() endforeach() file(GLOB_RECURSE __all_files "*CMakeLists.txt") foreach(_file ${__all_files}) if("${_file}" MATCHES "${PROJECT_SOURCE_DIR}/test") file(RELATIVE_PATH __file ${PROJECT_SOURCE_DIR} ${_file}) list(APPEND _cmakes ${__file}) endif() endforeach() list(APPEND AKANTU_TESTS_FILES ${_cmakes}) foreach(_file ${_all_files}) list(FIND AKANTU_TESTS_FILES ${_file} _ret) if(_ret EQUAL -1) list(APPEND AKANTU_TESTS_EXCLUDE_FILES /${_file}) endif() endforeach() set(AKANTU_TESTS_EXCLUDE_FILES ${AKANTU_TESTS_EXCLUDE_FILES} PARENT_SCOPE) #foreach(f ${AKANTU_TESTS_EXCLUDE_FILES}) # message(${f}) #endforeach() diff --git a/test/test_fem/CMakeLists.txt b/test/test_fem/CMakeLists.txt index b685a2514..c48f29e32 100644 --- a/test/test_fem/CMakeLists.txt +++ b/test/test_fem/CMakeLists.txt @@ -1,98 +1,100 @@ #=============================================================================== # @file CMakeLists.txt # # @author Guillaume Anciaux # # @date creation: Fri Sep 03 2010 # @date last modification: Fri May 30 2014 # # @brief configuration for FEM tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 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 # #=============================================================================== #=============================================================================== macro(register_fem_test operation type) set(_target test_${operation}_${_type}) register_test(${_target} SOURCES test_${operation}.cc FILES_TO_COPY _${type}.msh COMPILE_OPTIONS TYPE=_${_type} PACKAGE core ) endmacro() #=============================================================================== set(LIST_TYPES segment_2 segment_3 triangle_3 triangle_6 quadrangle_4 quadrangle_8 tetrahedron_4 tetrahedron_10 hexahedron_8 hexahedron_20 + pentahedron_6 + pentahedron_15 ) foreach(_type ${LIST_TYPES}) register_fem_test(interpolate ${_type}) register_fem_test(gradient ${_type}) register_fem_test(integrate ${_type}) register_fem_test(inverse_map ${_type}) endforeach() #register_test(test_interpolate_bernoulli_beam_2 test_interpolate_bernoulli_beam_2.cc) #add_mesh(test_fem_circle_1_mesh circle.geo 2 1 OUTPUT circle1.msh) #add_mesh(test_fem_circle_2_mesh circle.geo 2 2 OUTPUT circle2.msh) # Tests for class MeshData macro(register_typed_test test_name type value1 value2) set(target test_${test_name}_${type}) register_test(${target} SOURCES test_${test_name}.cc COMPILE_OPTIONS "TYPE=${type};VALUE1=${value1};VALUE2=${value2}" PACKAGE core ) endmacro() register_typed_test(mesh_data string \"5\" \"10\") register_typed_test(mesh_data UInt 5 10) add_mesh(test_boundary_msh cube.geo 3 1) add_mesh(test_boundary_msh_physical_names cube_physical_names.geo 3 1) register_test(test_mesh_boundary SOURCES test_mesh_boundary.cc DEPENDENCIES test_boundary_msh test_boundary_msh_physical_names PACKAGE core) register_test(test_facet_element_mapping SOURCES test_facet_element_mapping.cc DEPENDENCIES test_boundary_msh_physical_names PACKAGE core) register_test(test_igfem_integrate SOURCES test_igfem_integrate.cc PACKAGE igfem) diff --git a/test/test_fem/_pentahedron_15.msh b/test/test_fem/_pentahedron_15.msh new file mode 100755 index 000000000..a75af84a5 --- /dev/null +++ b/test/test_fem/_pentahedron_15.msh @@ -0,0 +1,74 @@ +$MeshFormat +2.2 0 8 +$EndMeshFormat +$Nodes +57 +1 0 0 -1 +2 1 0 -1 +3 0 1 -1 +4 0 0 1 +5 1 0 1 +6 0 1 1 +7 0.5 0 -1 +8 0 0.5 -1 +9 0 0 0 +10 0.5 0.5 -1 +11 1 0 0 +12 0 1 0 +13 0.5 0 1 +14 0 0.5 1 +15 0.5 0.5 1 +16 0.5 0 0 +17 0 0.5 0 +18 0.5 0.5 0 +19 0.25 0 -1 +20 0 0.25 -1 +21 0 0 -0.5 +22 0.25 0.25 -1 +23 0.5 0 -0.5 +24 0 0.5 -0.5 +25 0.25 0 0 +26 0 0.25 0 +27 0.25 0.25 0 +28 0 0 0.5 +29 0.5 0 0.5 +30 0 0.5 0.5 +31 0.25 0 1 +32 0 0.25 1 +33 0.25 0.25 1 +34 0.75 0 -1 +35 0.5 0.25 -1 +36 0.75 0.25 -1 +37 1 0 -0.5 +38 0.5 0.5 -0.5 +39 0.75 0 0 +40 0.5 0.25 0 +41 0.75 0.25 0 +42 1 0 0.5 +43 0.5 0.5 0.5 +44 0.75 0 1 +45 0.5 0.25 1 +46 0.75 0.25 1 +47 0.25 0.5 -1 +48 0 0.75 -1 +49 0.25 0.75 -1 +50 0 1 -0.5 +51 0.25 0.5 0 +52 0 0.75 0 +53 0.25 0.75 0 +54 0 1 0.5 +55 0.25 0.5 1 +56 0 0.75 1 +57 0.25 0.75 1 +$EndNodes +$Elements +8 +1 18 2 1 1 1 7 8 9 16 17 19 20 21 22 23 24 25 26 27 +2 18 2 1 1 9 16 17 4 13 14 25 26 28 27 29 30 31 32 33 +3 18 2 1 1 7 2 10 16 11 18 34 35 23 36 37 38 39 40 41 +4 18 2 1 1 16 11 18 13 5 15 39 40 29 41 42 43 44 45 46 +5 18 2 1 1 8 10 3 17 18 12 47 48 24 49 38 50 51 52 53 +6 18 2 1 1 17 18 12 14 15 6 51 52 30 53 43 54 55 56 57 +7 18 2 1 1 10 8 7 18 17 16 47 35 38 22 24 23 51 40 27 +8 18 2 1 1 18 17 16 15 14 13 51 40 43 27 30 29 55 45 33 +$EndElements diff --git a/test/test_fem/_pentahedron_6.msh b/test/test_fem/_pentahedron_6.msh new file mode 100755 index 000000000..a8f6ef2cf --- /dev/null +++ b/test/test_fem/_pentahedron_6.msh @@ -0,0 +1,148 @@ +$MeshFormat +2.2 0 8 +$EndMeshFormat +$Nodes +75 +1 0 0 -1 +2 1 0 -1 +3 0 1 -1 +4 0 0 1 +5 1 0 1 +6 0 1 1 +7 0.5 0 -1 +8 0 0.5 -1 +9 0 0 0 +10 0.5 0.5 -1 +11 1 0 0 +12 0 1 0 +13 0.5 0 1 +14 0 0.5 1 +15 0.5 0.5 1 +16 0.5 0 0 +17 0 0.5 0 +18 0.5 0.5 0 +19 0.25 0 -1 +20 0 0.25 -1 +21 0 0 -0.5 +22 0.25 0.25 -1 +23 0.5 0 -0.5 +24 0 0.5 -0.5 +25 0.25 0 0 +26 0 0.25 0 +27 0.25 0.25 0 +28 0.25 0 -0.5 +29 0 0.25 -0.5 +30 0.25 0.25 -0.5 +31 0 0 0.5 +32 0.5 0 0.5 +33 0 0.5 0.5 +34 0.25 0 1 +35 0 0.25 1 +36 0.25 0.25 1 +37 0.25 0 0.5 +38 0 0.25 0.5 +39 0.25 0.25 0.5 +40 0.75 0 -1 +41 0.5 0.25 -1 +42 0.75 0.25 -1 +43 1 0 -0.5 +44 0.5 0.5 -0.5 +45 0.75 0 0 +46 0.5 0.25 0 +47 0.75 0.25 0 +48 0.75 0 -0.5 +49 0.5 0.25 -0.5 +50 0.75 0.25 -0.5 +51 1 0 0.5 +52 0.5 0.5 0.5 +53 0.75 0 1 +54 0.5 0.25 1 +55 0.75 0.25 1 +56 0.75 0 0.5 +57 0.5 0.25 0.5 +58 0.75 0.25 0.5 +59 0.25 0.5 -1 +60 0 0.75 -1 +61 0.25 0.75 -1 +62 0 1 -0.5 +63 0.25 0.5 0 +64 0 0.75 0 +65 0.25 0.75 0 +66 0.25 0.5 -0.5 +67 0 0.75 -0.5 +68 0.25 0.75 -0.5 +69 0 1 0.5 +70 0.25 0.5 1 +71 0 0.75 1 +72 0.25 0.75 1 +73 0.25 0.5 0.5 +74 0 0.75 0.5 +75 0.25 0.75 0.5 +$EndNodes +$Elements +64 +1 6 2 1 1 1 19 20 21 28 29 +2 6 2 1 1 21 28 29 9 25 26 +3 6 2 1 1 19 7 22 28 23 30 +4 6 2 1 1 28 23 30 25 16 27 +5 6 2 1 1 20 22 8 29 30 24 +6 6 2 1 1 29 30 24 26 27 17 +7 6 2 1 1 22 20 19 30 29 28 +8 6 2 1 1 30 29 28 27 26 25 +9 6 2 1 1 9 25 26 31 37 38 +10 6 2 1 1 31 37 38 4 34 35 +11 6 2 1 1 25 16 27 37 32 39 +12 6 2 1 1 37 32 39 34 13 36 +13 6 2 1 1 26 27 17 38 39 33 +14 6 2 1 1 38 39 33 35 36 14 +15 6 2 1 1 27 26 25 39 38 37 +16 6 2 1 1 39 38 37 36 35 34 +17 6 2 1 1 7 40 41 23 48 49 +18 6 2 1 1 23 48 49 16 45 46 +19 6 2 1 1 40 2 42 48 43 50 +20 6 2 1 1 48 43 50 45 11 47 +21 6 2 1 1 41 42 10 49 50 44 +22 6 2 1 1 49 50 44 46 47 18 +23 6 2 1 1 42 41 40 50 49 48 +24 6 2 1 1 50 49 48 47 46 45 +25 6 2 1 1 16 45 46 32 56 57 +26 6 2 1 1 32 56 57 13 53 54 +27 6 2 1 1 45 11 47 56 51 58 +28 6 2 1 1 56 51 58 53 5 55 +29 6 2 1 1 46 47 18 57 58 52 +30 6 2 1 1 57 58 52 54 55 15 +31 6 2 1 1 47 46 45 58 57 56 +32 6 2 1 1 58 57 56 55 54 53 +33 6 2 1 1 8 59 60 24 66 67 +34 6 2 1 1 24 66 67 17 63 64 +35 6 2 1 1 59 10 61 66 44 68 +36 6 2 1 1 66 44 68 63 18 65 +37 6 2 1 1 60 61 3 67 68 62 +38 6 2 1 1 67 68 62 64 65 12 +39 6 2 1 1 61 60 59 68 67 66 +40 6 2 1 1 68 67 66 65 64 63 +41 6 2 1 1 17 63 64 33 73 74 +42 6 2 1 1 33 73 74 14 70 71 +43 6 2 1 1 63 18 65 73 52 75 +44 6 2 1 1 73 52 75 70 15 72 +45 6 2 1 1 64 65 12 74 75 69 +46 6 2 1 1 74 75 69 71 72 6 +47 6 2 1 1 65 64 63 75 74 73 +48 6 2 1 1 75 74 73 72 71 70 +49 6 2 1 1 10 59 41 44 66 49 +50 6 2 1 1 44 66 49 18 63 46 +51 6 2 1 1 59 8 22 66 24 30 +52 6 2 1 1 66 24 30 63 17 27 +53 6 2 1 1 41 22 7 49 30 23 +54 6 2 1 1 49 30 23 46 27 16 +55 6 2 1 1 22 41 59 30 49 66 +56 6 2 1 1 30 49 66 27 46 63 +57 6 2 1 1 18 63 46 52 73 57 +58 6 2 1 1 52 73 57 15 70 54 +59 6 2 1 1 63 17 27 73 33 39 +60 6 2 1 1 73 33 39 70 14 36 +61 6 2 1 1 46 27 16 57 39 32 +62 6 2 1 1 57 39 32 54 36 13 +63 6 2 1 1 27 46 63 39 57 73 +64 6 2 1 1 39 57 73 36 54 70 +$EndElements diff --git a/test/test_fem/test_gradient_hexahedron_20.verified b/test/test_fem/test_gradient_hexahedron_20.verified index e69de29bb..0bba1973e 100644 --- a/test/test_fem/test_gradient_hexahedron_20.verified +++ b/test/test_fem/test_gradient_hexahedron_20.verified @@ -0,0 +1,76 @@ +Epsilon : 1e-12 +FEEngine [ + + id : my_fem + + element dimension : 3 + + mesh [ + Mesh [ + + id : mesh + + spatial dimension : 3 + + nodes [ + Array [ + + id : mesh:coordinates + + size : 81 + + nb_component : 3 + + allocated size : 2000 + + memory size : 46.88KiByte + + values : {{-0.5, -0.5, -0.5}, {0.5, -0.5, -0.5}, {-0.5, 0.5, -0.5}, {0.5, 0.5, -0.5}, {-0.5, -0.5, 0.5}, {0.5, -0.5, 0.5}, {0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}, {0, -0.5, -0.5}, {-0.25, -0.5, -0.5}, {0.25, -0.5, -0.5}, {0, 0.5, -0.5}, {-0.25, 0.5, -0.5}, {0.25, 0.5, -0.5}, {-0.5, 0, -0.5}, {-0.5, -0.25, -0.5}, {-0.5, 0.25, -0.5}, {0.5, 0, -0.5}, {0.5, -0.25, -0.5}, {0.5, 0.25, -0.5}, {0, -0.5, 0.5}, {-0.25, -0.5, 0.5}, {0.25, -0.5, 0.5}, {0.5, 0, 0.5}, {0.5, -0.25, 0.5}, {0.5, 0.25, 0.5}, {0, 0.5, 0.5}, {0.25, 0.5, 0.5}, {-0.25, 0.5, 0.5}, {-0.5, 0, 0.5}, {-0.5, 0.25, 0.5}, {-0.5, -0.25, 0.5}, {-0.5, -0.5, 0}, {-0.5, -0.5, -0.25}, {-0.5, -0.5, 0.25}, {0.5, -0.5, 0}, {0.5, -0.5, -0.25}, {0.5, -0.5, 0.25}, {0.5, 0.5, 0}, {0.5, 0.5, -0.25}, {0.5, 0.5, 0.25}, {-0.5, 0.5, 0}, {-0.5, 0.5, -0.25}, {-0.5, 0.5, 0.25}, {0, 0, -0.5}, {0, -0.25, -0.5}, {-0.25, 0, -0.5}, {0, 0.25, -0.5}, {0.25, 0, -0.5}, {0, -0.5, 0}, {0, -0.5, -0.25}, {-0.25, -0.5, 0}, {0, -0.5, 0.25}, {0.25, -0.5, 0}, {0.5, 0, 0}, {0.5, 0, -0.25}, {0.5, -0.25, 0}, {0.5, 0, 0.25}, {0.5, 0.25, 0}, {0, 0.5, 0}, {-0.25, 0.5, 0}, {0, 0.5, -0.25}, {0, 0.5, 0.25}, {0.25, 0.5, 0}, {-0.5, 0, 0}, {-0.5, -0.25, 0}, {-0.5, 0, -0.25}, {-0.5, 0, 0.25}, {-0.5, 0.25, 0}, {0, 0, 0.5}, {0, -0.25, 0.5}, {-0.25, 0, 0.5}, {0, 0.25, 0.5}, {0.25, 0, 0.5}, {0, 0, 0}, {0, 0, -0.25}, {0, -0.25, 0}, {-0.25, 0, 0}, {0, 0, 0.25}, {0, 0.25, 0}, {0.25, 0, 0}} + ] + + connectivities [ + ElementTypeMapArray [ + (not_ghost:_point_1) [ + Array [ + + id : mesh:connectivities:_point_1 + + size : 8 + + nb_component : 1 + + allocated size : 2000 + + memory size : 7.81KiByte + + values : {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}} + ] + ] + (not_ghost:_segment_3) [ + Array [ + + id : mesh:connectivities:_segment_3 + + size : 24 + + nb_component : 3 + + allocated size : 2000 + + memory size : 23.44KiByte + + values : {{0, 8, 9}, {8, 1, 10}, {2, 11, 12}, {11, 3, 13}, {0, 14, 15}, {14, 2, 16}, {1, 17, 18}, {17, 3, 19}, {4, 20, 21}, {20, 5, 22}, {5, 23, 24}, {23, 6, 25}, {6, 26, 27}, {26, 7, 28}, {7, 29, 30}, {29, 4, 31}, {0, 32, 33}, {32, 4, 34}, {1, 35, 36}, {35, 5, 37}, {3, 38, 39}, {38, 6, 40}, {2, 41, 42}, {41, 7, 43}} + ] + ] + (not_ghost:_quadrangle_8) [ + Array [ + + id : mesh:connectivities:_quadrangle_8 + + size : 24 + + nb_component : 8 + + allocated size : 2000 + + memory size : 62.50KiByte + + values : {{0, 8, 44, 14, 9, 45, 46, 15}, {14, 44, 11, 2, 46, 47, 12, 16}, {8, 1, 17, 44, 10, 18, 48, 45}, {44, 17, 3, 11, 48, 19, 13, 47}, {0, 8, 49, 32, 9, 50, 51, 33}, {32, 49, 20, 4, 51, 52, 21, 34}, {8, 1, 35, 49, 10, 36, 53, 50}, {49, 35, 5, 20, 53, 37, 22, 52}, {1, 17, 54, 35, 18, 55, 56, 36}, {35, 54, 23, 5, 56, 57, 24, 37}, {17, 3, 38, 54, 19, 39, 58, 55}, {54, 38, 6, 23, 58, 40, 25, 57}, {2, 41, 59, 11, 42, 60, 61, 12}, {41, 7, 26, 59, 43, 28, 62, 60}, {11, 59, 38, 3, 61, 63, 39, 13}, {59, 26, 6, 38, 62, 27, 40, 63}, {0, 32, 64, 14, 33, 65, 66, 15}, {32, 4, 29, 64, 34, 31, 67, 65}, {14, 64, 41, 2, 66, 68, 42, 16}, {64, 29, 7, 41, 67, 30, 43, 68}, {4, 20, 69, 29, 21, 70, 71, 31}, {29, 69, 26, 7, 71, 72, 28, 30}, {20, 5, 23, 69, 22, 24, 73, 70}, {69, 23, 6, 26, 73, 25, 27, 72}} + ] + ] + (not_ghost:_hexahedron_20) [ + Array [ + + id : mesh:connectivities:_hexahedron_20 + + size : 8 + + nb_component : 20 + + allocated size : 2000 + + memory size : 156.25KiByte + + values : {{0, 8, 44, 14, 32, 49, 74, 64, 9, 45, 46, 15, 33, 50, 75, 66, 51, 76, 77, 65}, {32, 49, 74, 64, 4, 20, 69, 29, 51, 76, 77, 65, 34, 52, 78, 67, 21, 70, 71, 31}, {14, 44, 11, 2, 64, 74, 59, 41, 46, 47, 12, 16, 66, 75, 61, 42, 77, 79, 60, 68}, {64, 74, 59, 41, 29, 69, 26, 7, 77, 79, 60, 68, 67, 78, 62, 43, 71, 72, 28, 30}, {8, 1, 17, 44, 49, 35, 54, 74, 10, 18, 48, 45, 50, 36, 55, 75, 53, 56, 80, 76}, {49, 35, 54, 74, 20, 5, 23, 69, 53, 56, 80, 76, 52, 37, 57, 78, 22, 24, 73, 70}, {44, 17, 3, 11, 74, 54, 38, 59, 48, 19, 13, 47, 75, 55, 39, 61, 80, 58, 63, 79}, {74, 54, 38, 59, 69, 23, 6, 26, 80, 58, 63, 79, 78, 57, 40, 62, 73, 25, 27, 72}} + ] + ] + ] + ] + GroupManager [ + ] + ] + ] +] + +Array [ + + id : grad_on_quad + + size : 64 + + nb_component : 6 + + allocated size : 64 + + memory size : 3.00KiByte + + values : {{13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}, {13, 11, 23, 7, 31, 5}} +] + diff --git a/test/test_fem/test_integrate_hexahedron_20.verified b/test/test_fem/test_integrate_hexahedron_20.verified index e69de29bb..6fb4268cb 100644 --- a/test/test_fem/test_integrate_hexahedron_20.verified +++ b/test/test_fem/test_integrate_hexahedron_20.verified @@ -0,0 +1,67 @@ +Epsilon : 3e-13 +FEEngine [ + + id : my_fem + + element dimension : 3 + + mesh [ + Mesh [ + + id : mesh + + spatial dimension : 3 + + nodes [ + Array [ + + id : mesh:coordinates + + size : 81 + + nb_component : 3 + + allocated size : 2000 + + memory size : 46.88KiByte + + values : {{-0.5, -0.5, -0.5}, {0.5, -0.5, -0.5}, {-0.5, 0.5, -0.5}, {0.5, 0.5, -0.5}, {-0.5, -0.5, 0.5}, {0.5, -0.5, 0.5}, {0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}, {0, -0.5, -0.5}, {-0.25, -0.5, -0.5}, {0.25, -0.5, -0.5}, {0, 0.5, -0.5}, {-0.25, 0.5, -0.5}, {0.25, 0.5, -0.5}, {-0.5, 0, -0.5}, {-0.5, -0.25, -0.5}, {-0.5, 0.25, -0.5}, {0.5, 0, -0.5}, {0.5, -0.25, -0.5}, {0.5, 0.25, -0.5}, {0, -0.5, 0.5}, {-0.25, -0.5, 0.5}, {0.25, -0.5, 0.5}, {0.5, 0, 0.5}, {0.5, -0.25, 0.5}, {0.5, 0.25, 0.5}, {0, 0.5, 0.5}, {0.25, 0.5, 0.5}, {-0.25, 0.5, 0.5}, {-0.5, 0, 0.5}, {-0.5, 0.25, 0.5}, {-0.5, -0.25, 0.5}, {-0.5, -0.5, 0}, {-0.5, -0.5, -0.25}, {-0.5, -0.5, 0.25}, {0.5, -0.5, 0}, {0.5, -0.5, -0.25}, {0.5, -0.5, 0.25}, {0.5, 0.5, 0}, {0.5, 0.5, -0.25}, {0.5, 0.5, 0.25}, {-0.5, 0.5, 0}, {-0.5, 0.5, -0.25}, {-0.5, 0.5, 0.25}, {0, 0, -0.5}, {0, -0.25, -0.5}, {-0.25, 0, -0.5}, {0, 0.25, -0.5}, {0.25, 0, -0.5}, {0, -0.5, 0}, {0, -0.5, -0.25}, {-0.25, -0.5, 0}, {0, -0.5, 0.25}, {0.25, -0.5, 0}, {0.5, 0, 0}, {0.5, 0, -0.25}, {0.5, -0.25, 0}, {0.5, 0, 0.25}, {0.5, 0.25, 0}, {0, 0.5, 0}, {-0.25, 0.5, 0}, {0, 0.5, -0.25}, {0, 0.5, 0.25}, {0.25, 0.5, 0}, {-0.5, 0, 0}, {-0.5, -0.25, 0}, {-0.5, 0, -0.25}, {-0.5, 0, 0.25}, {-0.5, 0.25, 0}, {0, 0, 0.5}, {0, -0.25, 0.5}, {-0.25, 0, 0.5}, {0, 0.25, 0.5}, {0.25, 0, 0.5}, {0, 0, 0}, {0, 0, -0.25}, {0, -0.25, 0}, {-0.25, 0, 0}, {0, 0, 0.25}, {0, 0.25, 0}, {0.25, 0, 0}} + ] + + connectivities [ + ElementTypeMapArray [ + (not_ghost:_point_1) [ + Array [ + + id : mesh:connectivities:_point_1 + + size : 8 + + nb_component : 1 + + allocated size : 2000 + + memory size : 7.81KiByte + + values : {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}} + ] + ] + (not_ghost:_segment_3) [ + Array [ + + id : mesh:connectivities:_segment_3 + + size : 24 + + nb_component : 3 + + allocated size : 2000 + + memory size : 23.44KiByte + + values : {{0, 8, 9}, {8, 1, 10}, {2, 11, 12}, {11, 3, 13}, {0, 14, 15}, {14, 2, 16}, {1, 17, 18}, {17, 3, 19}, {4, 20, 21}, {20, 5, 22}, {5, 23, 24}, {23, 6, 25}, {6, 26, 27}, {26, 7, 28}, {7, 29, 30}, {29, 4, 31}, {0, 32, 33}, {32, 4, 34}, {1, 35, 36}, {35, 5, 37}, {3, 38, 39}, {38, 6, 40}, {2, 41, 42}, {41, 7, 43}} + ] + ] + (not_ghost:_quadrangle_8) [ + Array [ + + id : mesh:connectivities:_quadrangle_8 + + size : 24 + + nb_component : 8 + + allocated size : 2000 + + memory size : 62.50KiByte + + values : {{0, 8, 44, 14, 9, 45, 46, 15}, {14, 44, 11, 2, 46, 47, 12, 16}, {8, 1, 17, 44, 10, 18, 48, 45}, {44, 17, 3, 11, 48, 19, 13, 47}, {0, 8, 49, 32, 9, 50, 51, 33}, {32, 49, 20, 4, 51, 52, 21, 34}, {8, 1, 35, 49, 10, 36, 53, 50}, {49, 35, 5, 20, 53, 37, 22, 52}, {1, 17, 54, 35, 18, 55, 56, 36}, {35, 54, 23, 5, 56, 57, 24, 37}, {17, 3, 38, 54, 19, 39, 58, 55}, {54, 38, 6, 23, 58, 40, 25, 57}, {2, 41, 59, 11, 42, 60, 61, 12}, {41, 7, 26, 59, 43, 28, 62, 60}, {11, 59, 38, 3, 61, 63, 39, 13}, {59, 26, 6, 38, 62, 27, 40, 63}, {0, 32, 64, 14, 33, 65, 66, 15}, {32, 4, 29, 64, 34, 31, 67, 65}, {14, 64, 41, 2, 66, 68, 42, 16}, {64, 29, 7, 41, 67, 30, 43, 68}, {4, 20, 69, 29, 21, 70, 71, 31}, {29, 69, 26, 7, 71, 72, 28, 30}, {20, 5, 23, 69, 22, 24, 73, 70}, {69, 23, 6, 26, 73, 25, 27, 72}} + ] + ] + (not_ghost:_hexahedron_20) [ + Array [ + + id : mesh:connectivities:_hexahedron_20 + + size : 8 + + nb_component : 20 + + allocated size : 2000 + + memory size : 156.25KiByte + + values : {{0, 8, 44, 14, 32, 49, 74, 64, 9, 45, 46, 15, 33, 50, 75, 66, 51, 76, 77, 65}, {32, 49, 74, 64, 4, 20, 69, 29, 51, 76, 77, 65, 34, 52, 78, 67, 21, 70, 71, 31}, {14, 44, 11, 2, 64, 74, 59, 41, 46, 47, 12, 16, 66, 75, 61, 42, 77, 79, 60, 68}, {64, 74, 59, 41, 29, 69, 26, 7, 77, 79, 60, 68, 67, 78, 62, 43, 71, 72, 28, 30}, {8, 1, 17, 44, 49, 35, 54, 74, 10, 18, 48, 45, 50, 36, 55, 75, 53, 56, 80, 76}, {49, 35, 54, 74, 20, 5, 23, 69, 53, 56, 80, 76, 52, 37, 57, 78, 22, 24, 73, 70}, {44, 17, 3, 11, 74, 54, 38, 59, 48, 19, 13, 47, 75, 55, 39, 61, 80, 58, 63, 79}, {74, 54, 38, 59, 69, 23, 6, 26, 80, 58, 63, 79, 78, 57, 40, 62, 73, 25, 27, 72}} + ] + ] + ] + ] + GroupManager [ + ] + ] + ] +] + diff --git a/test/test_fem/test_interpolate_hexahedron_20.verified b/test/test_fem/test_interpolate_hexahedron_20.verified index e69de29bb..6fb4268cb 100644 --- a/test/test_fem/test_interpolate_hexahedron_20.verified +++ b/test/test_fem/test_interpolate_hexahedron_20.verified @@ -0,0 +1,67 @@ +Epsilon : 3e-13 +FEEngine [ + + id : my_fem + + element dimension : 3 + + mesh [ + Mesh [ + + id : mesh + + spatial dimension : 3 + + nodes [ + Array [ + + id : mesh:coordinates + + size : 81 + + nb_component : 3 + + allocated size : 2000 + + memory size : 46.88KiByte + + values : {{-0.5, -0.5, -0.5}, {0.5, -0.5, -0.5}, {-0.5, 0.5, -0.5}, {0.5, 0.5, -0.5}, {-0.5, -0.5, 0.5}, {0.5, -0.5, 0.5}, {0.5, 0.5, 0.5}, {-0.5, 0.5, 0.5}, {0, -0.5, -0.5}, {-0.25, -0.5, -0.5}, {0.25, -0.5, -0.5}, {0, 0.5, -0.5}, {-0.25, 0.5, -0.5}, {0.25, 0.5, -0.5}, {-0.5, 0, -0.5}, {-0.5, -0.25, -0.5}, {-0.5, 0.25, -0.5}, {0.5, 0, -0.5}, {0.5, -0.25, -0.5}, {0.5, 0.25, -0.5}, {0, -0.5, 0.5}, {-0.25, -0.5, 0.5}, {0.25, -0.5, 0.5}, {0.5, 0, 0.5}, {0.5, -0.25, 0.5}, {0.5, 0.25, 0.5}, {0, 0.5, 0.5}, {0.25, 0.5, 0.5}, {-0.25, 0.5, 0.5}, {-0.5, 0, 0.5}, {-0.5, 0.25, 0.5}, {-0.5, -0.25, 0.5}, {-0.5, -0.5, 0}, {-0.5, -0.5, -0.25}, {-0.5, -0.5, 0.25}, {0.5, -0.5, 0}, {0.5, -0.5, -0.25}, {0.5, -0.5, 0.25}, {0.5, 0.5, 0}, {0.5, 0.5, -0.25}, {0.5, 0.5, 0.25}, {-0.5, 0.5, 0}, {-0.5, 0.5, -0.25}, {-0.5, 0.5, 0.25}, {0, 0, -0.5}, {0, -0.25, -0.5}, {-0.25, 0, -0.5}, {0, 0.25, -0.5}, {0.25, 0, -0.5}, {0, -0.5, 0}, {0, -0.5, -0.25}, {-0.25, -0.5, 0}, {0, -0.5, 0.25}, {0.25, -0.5, 0}, {0.5, 0, 0}, {0.5, 0, -0.25}, {0.5, -0.25, 0}, {0.5, 0, 0.25}, {0.5, 0.25, 0}, {0, 0.5, 0}, {-0.25, 0.5, 0}, {0, 0.5, -0.25}, {0, 0.5, 0.25}, {0.25, 0.5, 0}, {-0.5, 0, 0}, {-0.5, -0.25, 0}, {-0.5, 0, -0.25}, {-0.5, 0, 0.25}, {-0.5, 0.25, 0}, {0, 0, 0.5}, {0, -0.25, 0.5}, {-0.25, 0, 0.5}, {0, 0.25, 0.5}, {0.25, 0, 0.5}, {0, 0, 0}, {0, 0, -0.25}, {0, -0.25, 0}, {-0.25, 0, 0}, {0, 0, 0.25}, {0, 0.25, 0}, {0.25, 0, 0}} + ] + + connectivities [ + ElementTypeMapArray [ + (not_ghost:_point_1) [ + Array [ + + id : mesh:connectivities:_point_1 + + size : 8 + + nb_component : 1 + + allocated size : 2000 + + memory size : 7.81KiByte + + values : {{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}} + ] + ] + (not_ghost:_segment_3) [ + Array [ + + id : mesh:connectivities:_segment_3 + + size : 24 + + nb_component : 3 + + allocated size : 2000 + + memory size : 23.44KiByte + + values : {{0, 8, 9}, {8, 1, 10}, {2, 11, 12}, {11, 3, 13}, {0, 14, 15}, {14, 2, 16}, {1, 17, 18}, {17, 3, 19}, {4, 20, 21}, {20, 5, 22}, {5, 23, 24}, {23, 6, 25}, {6, 26, 27}, {26, 7, 28}, {7, 29, 30}, {29, 4, 31}, {0, 32, 33}, {32, 4, 34}, {1, 35, 36}, {35, 5, 37}, {3, 38, 39}, {38, 6, 40}, {2, 41, 42}, {41, 7, 43}} + ] + ] + (not_ghost:_quadrangle_8) [ + Array [ + + id : mesh:connectivities:_quadrangle_8 + + size : 24 + + nb_component : 8 + + allocated size : 2000 + + memory size : 62.50KiByte + + values : {{0, 8, 44, 14, 9, 45, 46, 15}, {14, 44, 11, 2, 46, 47, 12, 16}, {8, 1, 17, 44, 10, 18, 48, 45}, {44, 17, 3, 11, 48, 19, 13, 47}, {0, 8, 49, 32, 9, 50, 51, 33}, {32, 49, 20, 4, 51, 52, 21, 34}, {8, 1, 35, 49, 10, 36, 53, 50}, {49, 35, 5, 20, 53, 37, 22, 52}, {1, 17, 54, 35, 18, 55, 56, 36}, {35, 54, 23, 5, 56, 57, 24, 37}, {17, 3, 38, 54, 19, 39, 58, 55}, {54, 38, 6, 23, 58, 40, 25, 57}, {2, 41, 59, 11, 42, 60, 61, 12}, {41, 7, 26, 59, 43, 28, 62, 60}, {11, 59, 38, 3, 61, 63, 39, 13}, {59, 26, 6, 38, 62, 27, 40, 63}, {0, 32, 64, 14, 33, 65, 66, 15}, {32, 4, 29, 64, 34, 31, 67, 65}, {14, 64, 41, 2, 66, 68, 42, 16}, {64, 29, 7, 41, 67, 30, 43, 68}, {4, 20, 69, 29, 21, 70, 71, 31}, {29, 69, 26, 7, 71, 72, 28, 30}, {20, 5, 23, 69, 22, 24, 73, 70}, {69, 23, 6, 26, 73, 25, 27, 72}} + ] + ] + (not_ghost:_hexahedron_20) [ + Array [ + + id : mesh:connectivities:_hexahedron_20 + + size : 8 + + nb_component : 20 + + allocated size : 2000 + + memory size : 156.25KiByte + + values : {{0, 8, 44, 14, 32, 49, 74, 64, 9, 45, 46, 15, 33, 50, 75, 66, 51, 76, 77, 65}, {32, 49, 74, 64, 4, 20, 69, 29, 51, 76, 77, 65, 34, 52, 78, 67, 21, 70, 71, 31}, {14, 44, 11, 2, 64, 74, 59, 41, 46, 47, 12, 16, 66, 75, 61, 42, 77, 79, 60, 68}, {64, 74, 59, 41, 29, 69, 26, 7, 77, 79, 60, 68, 67, 78, 62, 43, 71, 72, 28, 30}, {8, 1, 17, 44, 49, 35, 54, 74, 10, 18, 48, 45, 50, 36, 55, 75, 53, 56, 80, 76}, {49, 35, 54, 74, 20, 5, 23, 69, 53, 56, 80, 76, 52, 37, 57, 78, 22, 24, 73, 70}, {44, 17, 3, 11, 74, 54, 38, 59, 48, 19, 13, 47, 75, 55, 39, 61, 80, 58, 63, 79}, {74, 54, 38, 59, 69, 23, 6, 26, 80, 58, 63, 79, 78, 57, 40, 62, 73, 25, 27, 72}} + ] + ] + ] + ] + GroupManager [ + ] + ] + ] +] + diff --git a/test/test_fem/test_inverse_map_hexahedron_20.verified b/test/test_fem/test_inverse_map_hexahedron_20.verified index e69de29bb..2e23c245e 100644 --- a/test/test_fem/test_inverse_map_hexahedron_20.verified +++ b/test/test_fem/test_inverse_map_hexahedron_20.verified @@ -0,0 +1 @@ +inverse completed over 8 elements diff --git a/test/test_mesh_utils/CMakeLists.txt b/test/test_mesh_utils/CMakeLists.txt index 398a8eb47..2226ea5c9 100644 --- a/test/test_mesh_utils/CMakeLists.txt +++ b/test/test_mesh_utils/CMakeLists.txt @@ -1,48 +1,48 @@ #=============================================================================== # @file CMakeLists.txt # # @author Nicolas Richart # # @date creation: Mon Feb 07 2011 # @date last modification: Tue Nov 06 2012 # # @brief configuration for MeshUtils tests # # @section LICENSE # # Copyright (©) 2010-2012, 2014 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 # #=============================================================================== #=============================================================================== # List of tests #=============================================================================== add_akantu_test(test_mesh_io "Test mesh io object") -add_akantu_test(test_facet_extraction "Test mesh utils facet extraction") add_akantu_test(test_pbc_tweak "Test pbc facilities") +add_akantu_test(test_buildfacets "Tests for the generation of facets") register_test(test_purify_mesh SOURCES test_purify_mesh.cc FILES_TO_COPY purify_mesh.msh PACKAGE core ) add_akantu_test(test_mesh_partitionate "Test mesh partition creation") diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt b/test/test_mesh_utils/test_buildfacets/CMakeLists.txt similarity index 79% rename from test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt rename to test/test_mesh_utils/test_buildfacets/CMakeLists.txt index 9ccc985cc..25a03db1c 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/CMakeLists.txt +++ b/test/test_mesh_utils/test_buildfacets/CMakeLists.txt @@ -1,45 +1,42 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date Tue May 08 13:01:18 2012 # # @brief configuration for build facets test # # @section LICENSE # # Copyright (©) 2010-2011 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_test(test_cohesive_buildfacets_tetrahedron - SOURCES test_cohesive_buildfacets_tetrahedron.cc +register_test(test_buildfacets_tetrahedron + SOURCES test_buildfacets_tetrahedron.cc FILES_TO_COPY tetrahedron.msh PACKAGE cohesive_element ) -register_test(test_cohesive_buildfacets_hexahedron - SOURCES test_cohesive_buildfacets_hexahedron.cc +register_test(test_buildfacets_hexahedron + SOURCES test_buildfacets_hexahedron.cc FILES_TO_COPY hexahedron.msh PACKAGE cohesive_element ) -#add_mesh(test_cohesive_buildfacets_mesh mesh.geo 3 2) -#add_dependencies(test_cohesive_buildfacets test_cohesive_buildfacets_mesh) - diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/hexahedron.msh b/test/test_mesh_utils/test_buildfacets/hexahedron.msh similarity index 100% rename from test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/hexahedron.msh rename to test/test_mesh_utils/test_buildfacets/hexahedron.msh diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_hexahedron.cc b/test/test_mesh_utils/test_buildfacets/test_buildfacets_hexahedron.cc similarity index 98% rename from test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_hexahedron.cc rename to test/test_mesh_utils/test_buildfacets/test_buildfacets_hexahedron.cc index 8d1143306..c4d5024cb 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_hexahedron.cc +++ b/test/test_mesh_utils/test_buildfacets/test_buildfacets_hexahedron.cc @@ -1,228 +1,224 @@ /** * @file test_cohesive_buildfacets_hexahedron.cc * * @author Marco Vocialta * * @date Wed Oct 03 10:20:53 2012 * * @brief Test for cohesive elements * * @section LICENSE * * Copyright (©) 2010-2011 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 /* -------------------------------------------------------------------------- */ #include "aka_common.hh" #include "mesh.hh" -#include "mesh_io.hh" -#include "mesh_io_msh.hh" #include "mesh_utils.hh" -#include "solid_mechanics_model.hh" -#include "material.hh" /* -------------------------------------------------------------------------- */ using namespace akantu; int main(int argc, char *argv[]) { initialize(argc, argv); const UInt spatial_dimension = 3; const ElementType type = _hexahedron_8; Mesh mesh(spatial_dimension); mesh.read("hexahedron.msh"); Mesh mesh_facets(mesh.initMeshFacets("mesh_facets")); MeshUtils::buildAllFacets(mesh, mesh_facets); // debug::setDebugLevel(dblDump); // std::cout << mesh << std::endl; // std::cout << mesh_facets << std::endl; const ElementType type_facet = mesh.getFacetType(type); const ElementType type_subfacet = mesh.getFacetType(type_facet); const ElementType type_subsubfacet = mesh.getFacetType(type_subfacet); /* ------------------------------------------------------------------------ */ /* Element to Subelement testing */ /* ------------------------------------------------------------------------ */ const Array< std::vector > & el_to_subel3 = mesh_facets.getElementToSubelement(type_facet); const Array< std::vector > & el_to_subel2 = mesh_facets.getElementToSubelement(type_subfacet); const Array< std::vector > & el_to_subel1 = mesh_facets.getElementToSubelement(type_subsubfacet); /// build vectors for comparison Array hexahedron(2); hexahedron(0).type = type; hexahedron(0).element = 0; hexahedron(1).type = type; hexahedron(1).element = 3; Array quadrangle(4); quadrangle(0).type = type_facet; quadrangle(0).element = 1; quadrangle(1).type = type_facet; quadrangle(1).element = 2; quadrangle(2).type = type_facet; quadrangle(2).element = 7; quadrangle(3).type = type_facet; quadrangle(3).element = 11; Array segment(5); segment(0).type = type_subfacet; segment(0).element = 0; segment(1).type = type_subfacet; segment(1).element = 1; segment(2).type = type_subfacet; segment(2).element = 4; segment(3).type = type_subfacet; segment(3).element = 15; segment(4).type = type_subfacet; segment(4).element = 22; /// comparison for (UInt i = 0; i < hexahedron.getSize(); ++i) { if (hexahedron(i).type != el_to_subel3(1)[i].type || hexahedron(i).element != el_to_subel3(1)[i].element) { std::cout << hexahedron(i).element << " " << el_to_subel3(4)[i].element << std::endl; std::cout << "The two hexahedrons connected to quadrangle 1 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < quadrangle.getSize(); ++i) { if (quadrangle(i).type != el_to_subel2(4)[i].type || quadrangle(i).element != el_to_subel2(4)[i].element) { std::cout << "The quadrangles connected to segment 4 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < segment.getSize(); ++i) { if (segment(i).type != el_to_subel1(1)[i].type || segment(i).element != el_to_subel1(1)[i].element) { std::cout << "The segments connected to point 1 are wrong" << std::endl; return EXIT_FAILURE; } } /* ------------------------------------------------------------------------ */ /* Subelement to Element testing */ /* ------------------------------------------------------------------------ */ const Array & subel_to_el3 = mesh_facets.getSubelementToElement(type); const Array & subel_to_el2 = mesh_facets.getSubelementToElement(type_facet); const Array & subel_to_el1 = mesh_facets.getSubelementToElement(type_subfacet); /// build vectors for comparison Array quadrangle2(mesh.getNbFacetsPerElement(type)); quadrangle2(0).type = type_facet; quadrangle2(0).element = 1; quadrangle2(1).type = type_facet; quadrangle2(1).element = 11; quadrangle2(2).type = type_facet; quadrangle2(2).element = 16; quadrangle2(3).type = type_facet; quadrangle2(3).element = 17; quadrangle2(4).type = type_facet; quadrangle2(4).element = 18; quadrangle2(5).type = type_facet; quadrangle2(5).element = 19; Array segment2(4); segment2(0).type = type_subfacet; segment2(0).element = 3; segment2(1).type = type_subfacet; segment2(1).element = 6; segment2(2).type = type_subfacet; segment2(2).element = 9; segment2(3).type = type_subfacet; segment2(3).element = 11; Array point(2); point(0).type = mesh.getFacetType(type_subfacet); point(0).element = 5; point(1).type = mesh.getFacetType(type_subfacet); point(1).element = 7; /// comparison for (UInt i = 0; i < quadrangle2.getSize(); ++i) { if (quadrangle2(i).type != subel_to_el3(3, i).type || quadrangle2(i).element != subel_to_el3(3, i).element) { std::cout << "The quadrangles connected to hexahedron 3 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < segment2.getSize(); ++i) { if (segment2(i).type != subel_to_el2(4, i).type || segment2(i).element != subel_to_el2(4, i).element) { std::cout << "The segments connected to quadrangle 4 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < point.getSize(); ++i) { if (point(i).type != subel_to_el1(11, i).type || point(i).element != subel_to_el1(11, i).element) { std::cout << "The points connected to segment 11 are wrong" << std::endl; return EXIT_FAILURE; } } finalize(); std::cout << "OK: test_cohesive_buildfacets was passed!" << std::endl; return EXIT_SUCCESS; } diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_tetrahedron.cc b/test/test_mesh_utils/test_buildfacets/test_buildfacets_tetrahedron.cc similarity index 98% rename from test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_tetrahedron.cc rename to test/test_mesh_utils/test_buildfacets/test_buildfacets_tetrahedron.cc index 33d46cb20..19ad0eccb 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/test_cohesive_buildfacets_tetrahedron.cc +++ b/test/test_mesh_utils/test_buildfacets/test_buildfacets_tetrahedron.cc @@ -1,253 +1,249 @@ /** * @file test_cohesive_buildfacets_tetrahedron.cc * * @author Marco Vocialta * * @date Wed Oct 03 10:20:53 2012 * * @brief Test for cohesive elements * * @section LICENSE * * Copyright (©) 2010-2011 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 /* -------------------------------------------------------------------------- */ #include "aka_common.hh" #include "mesh.hh" -#include "mesh_io.hh" -#include "mesh_io_msh.hh" #include "mesh_utils.hh" -#include "solid_mechanics_model.hh" -#include "material.hh" /* -------------------------------------------------------------------------- */ using namespace akantu; int main(int argc, char *argv[]) { initialize(argc, argv); const UInt spatial_dimension = 3; const ElementType type = _tetrahedron_10; Mesh mesh(spatial_dimension); mesh.read("tetrahedron.msh"); Mesh mesh_facets(mesh.initMeshFacets("mesh_facets")); MeshUtils::buildAllFacets(mesh, mesh_facets); // debug::setDebugLevel(dblDump); // std::cout << mesh << std::endl; // std::cout << mesh_facets << std::endl; const ElementType type_facet = mesh.getFacetType(type); const ElementType type_subfacet = mesh.getFacetType(type_facet); const ElementType type_subsubfacet = mesh.getFacetType(type_subfacet); /* ------------------------------------------------------------------------ */ /* Element to Subelement testing */ /* ------------------------------------------------------------------------ */ const Array< std::vector > & el_to_subel3 = mesh_facets.getElementToSubelement(type_facet); const Array< std::vector > & el_to_subel2 = mesh_facets.getElementToSubelement(type_subfacet); const Array< std::vector > & el_to_subel1 = mesh_facets.getElementToSubelement(type_subsubfacet); /// build vectors for comparison Array tetrahedron(2); tetrahedron(0).type = type; tetrahedron(0).element = 1; tetrahedron(1).type = type; tetrahedron(1).element = 11; Array triangle(8); triangle(0).type = type_facet; triangle(0).element = 0; triangle(1).type = type_facet; triangle(1).element = 2; triangle(2).type = type_facet; triangle(2).element = 4; triangle(3).type = type_facet; triangle(3).element = 7; triangle(4).type = type_facet; triangle(4).element = 16; triangle(5).type = type_facet; triangle(5).element = 18; triangle(6).type = type_facet; triangle(6).element = 24; triangle(7).type = type_facet; triangle(7).element = 26; Array segment(13); segment(0).type = type_subfacet; segment(0).element = 0; segment(1).type = type_subfacet; segment(1).element = 1; segment(2).type = type_subfacet; segment(2).element = 3; segment(3).type = type_subfacet; segment(3).element = 7; segment(4).type = type_subfacet; segment(4).element = 9; segment(5).type = type_subfacet; segment(5).element = 12; segment(6).type = type_subfacet; segment(6).element = 13; segment(7).type = type_subfacet; segment(7).element = 16; segment(8).type = type_subfacet; segment(8).element = 18; segment(9).type = type_subfacet; segment(9).element = 21; segment(10).type = type_subfacet; segment(10).element = 27; segment(11).type = type_subfacet; segment(11).element = 32; segment(12).type = type_subfacet; segment(12).element = 34; /// comparison for (UInt i = 0; i < tetrahedron.getSize(); ++i) { if (tetrahedron(i).type != el_to_subel3(4)[i].type || tetrahedron(i).element != el_to_subel3(4)[i].element) { std::cout << tetrahedron(i).element << " " << el_to_subel3(4)[i].element << std::endl; std::cout << "The two tetrahedrons connected to triangle 4 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < triangle.getSize(); ++i) { if (triangle(i).type != el_to_subel2(0)[i].type || triangle(i).element != el_to_subel2(0)[i].element) { std::cout << "The triangles connected to segment 0 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < segment.getSize(); ++i) { if (segment(i).type != el_to_subel1(1)[i].type || segment(i).element != el_to_subel1(1)[i].element) { std::cout << "The segments connected to point 1 are wrong" << std::endl; return EXIT_FAILURE; } } /* ------------------------------------------------------------------------ */ /* Subelement to Element testing */ /* ------------------------------------------------------------------------ */ const Array & subel_to_el3 = mesh_facets.getSubelementToElement(type); const Array & subel_to_el2 = mesh_facets.getSubelementToElement(type_facet); const Array & subel_to_el1 = mesh_facets.getSubelementToElement(type_subfacet); /// build vectors for comparison Array triangle2(mesh.getNbFacetsPerElement(type)); triangle2(0).type = type_facet; triangle2(0).element = 4; triangle2(1).type = type_facet; triangle2(1).element = 5; triangle2(2).type = type_facet; triangle2(2).element = 6; triangle2(3).type = type_facet; triangle2(3).element = 7; Array segment2(3); segment2(0).type = type_subfacet; segment2(0).element = 1; segment2(1).type = type_subfacet; segment2(1).element = 3; segment2(2).type = type_subfacet; segment2(2).element = 4; Array point(2); point(0).type = mesh.getFacetType(type_subfacet); point(0).element = 1; point(1).type = mesh.getFacetType(type_subfacet); point(1).element = 2; /// comparison for (UInt i = 0; i < triangle2.getSize(); ++i) { if (triangle2(i).type != subel_to_el3(1, i).type || triangle2(i).element != subel_to_el3(1, i).element) { std::cout << "The triangles connected to tetrahedron 1 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < segment2.getSize(); ++i) { if (segment2(i).type != subel_to_el2(1, i).type || segment2(i).element != subel_to_el2(1, i).element) { std::cout << "The segments connected to triangle 1 are wrong" << std::endl; return EXIT_FAILURE; } } for (UInt i = 0; i < point.getSize(); ++i) { if (point(i).type != subel_to_el1(1, i).type || point(i).element != subel_to_el1(1, i).element) { std::cout << "The points connected to segment 1 are wrong" << std::endl; return EXIT_FAILURE; } } finalize(); std::cout << "OK: test_cohesive_buildfacets was passed!" << std::endl; return EXIT_SUCCESS; } diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/tetrahedron.msh b/test/test_mesh_utils/test_buildfacets/tetrahedron.msh similarity index 100% rename from test/test_model/test_solid_mechanics_model/test_cohesive/test_cohesive_buildfacets/tetrahedron.msh rename to test/test_mesh_utils/test_buildfacets/tetrahedron.msh diff --git a/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt b/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt deleted file mode 100644 index 2f04bc5b9..000000000 --- a/test/test_mesh_utils/test_facet_extraction/CMakeLists.txt +++ /dev/null @@ -1,51 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Guillaume Anciaux -# -# @date creation: Fri Sep 03 2010 -# @date last modification: Tue Nov 06 2012 -# -# @brief configuration for facet extraction tests -# -# @section LICENSE -# -# Copyright (©) 2010-2012, 2014 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(test_facet_square_mesh square.geo 2 2) - -register_test(test_facet_extraction_triangle_3 - SOURCES test_facet_extraction_triangle_3.cc - DEPENDENCIES test_facet_square_mesh - DIRECTORIES_TO_CREATE paraview - PACKAGE core - ) - -#=============================================================================== -add_mesh(test_facet_cube_mesh cube.geo 3 1) - -register_test(test_facet_extraction_tetrahedron_4 - SOURCES test_facet_extraction_tetrahedron_4.cc - DEPENDENCIES test_facet_cube_mesh - DIRECTORIES_TO_CREATE paraview - PACKAGE core - ) diff --git a/test/test_mesh_utils/test_facet_extraction/cube.geo b/test/test_mesh_utils/test_facet_extraction/cube.geo deleted file mode 100644 index 415cca7c4..000000000 --- a/test/test_mesh_utils/test_facet_extraction/cube.geo +++ /dev/null @@ -1,37 +0,0 @@ -h = 0.1; - -Point(1) = {0.0, 0.0, 0.0, h}; -Point(2) = {1.0, 0.0, 0.0, h}; -Point(3) = {0.0, 1.0, 0.0, h}; -Point(4) = {1.0, 1.0, 0.0, h}; -Point(5) = {0.0, 0.0, 1.0, h}; -Point(6) = {1.0, 0.0, 1.0, h}; -Point(7) = {0.0, 1.0, 1.0, h}; -Point(8) = {1.0, 1.0, 1.0, h}; - -Line(1) = {7, 8}; -Line(2) = {8, 4}; -Line(3) = {4, 3}; -Line(4) = {3, 7}; -Line(5) = {1, 5}; -Line(6) = {5, 6}; -Line(7) = {6, 2}; -Line(8) = {2, 1}; -Line(9) = {3, 1}; -Line(10) = {7, 5}; -Line(11) = {8, 6}; -Line(12) = {4, 2}; -Line Loop(13) = {1, 11, -6, -10}; -Plane Surface(14) = {13}; -Line Loop(15) = {3, 4, 1, 2}; -Plane Surface(16) = {15}; -Line Loop(17) = {6, 7, 8, 5}; -Plane Surface(18) = {17}; -Line Loop(19) = {3, 9, -8, -12}; -Plane Surface(20) = {19}; -Line Loop(21) = {4, 10, -5, -9}; -Plane Surface(22) = {21}; -Line Loop(23) = {11, 7, -12, -2}; -Plane Surface(24) = {23}; -Surface Loop(25) = {24, 14, 16, 20, 22, 18}; -Volume(26) = {25}; diff --git a/test/test_mesh_utils/test_facet_extraction/square.geo b/test/test_mesh_utils/test_facet_extraction/square.geo deleted file mode 100644 index 33d1d3cc2..000000000 --- a/test/test_mesh_utils/test_facet_extraction/square.geo +++ /dev/null @@ -1,11 +0,0 @@ -Point(1) = {0.0, 0.0, 0.0, .5}; -Point(2) = {1.0, 0.0, 0.0, .5}; -Point(3) = {0.0, 1.0, 0.0, .5}; -Point(4) = {1.0, 1.0, 0.0, .5}; - -Line(1) = {1, 2}; -Line(2) = {2, 4}; -Line(3) = {4, 3}; -Line(4) = {3, 1}; -Line Loop(1) = {1, 2, 3, 4}; -Plane Surface(1) = {1}; diff --git a/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_tetrahedron_4.cc b/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_tetrahedron_4.cc deleted file mode 100644 index e7ab326b1..000000000 --- a/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_tetrahedron_4.cc +++ /dev/null @@ -1,77 +0,0 @@ -/** - * @file test_facet_extraction_tetrahedron_4.cc - * - * @author Guillaume Anciaux - * @author Marco Vocialta - * - * @date creation: Fri Sep 03 2010 - * @date last modification: Tue Jan 07 2014 - * - * @brief test of internal facet extraction - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014 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 "mesh.hh" -#include "mesh_io.hh" -#include "mesh_io_msh.hh" -#include "mesh_utils.hh" -#include "solid_mechanics_model.hh" -#include "material.hh" -/* -------------------------------------------------------------------------- */ -#ifdef AKANTU_USE_IOHELPER -# include "dumper_paraview.hh" -#endif //AKANTU_USE_IOHELPER - -using namespace akantu; - -int main(int argc, char *argv[]) -{ - akantu::initialize(argc, argv); - int dim = 3; - - Mesh mesh(dim); - MeshIOMSH mesh_io; - mesh_io.read("cube.msh", mesh); - Mesh mesh_facets(mesh.initMeshFacets("mesh_facets")); - - MeshUtils::buildAllFacets(mesh, mesh_facets); - -#ifdef AKANTU_USE_IOHELPER - DumperParaview dumper1("test-facet-extraction"); - dumper1.registerMesh(mesh, dim); - dumper1.dump(); - - DumperParaview dumper2("test-facet-extraction_boundary"); - dumper2.registerMesh(mesh, dim - 1); - dumper2.dump(); - - DumperParaview dumper3("test-facet-extraction_internal"); - dumper3.registerMesh(mesh_facets, dim); - dumper3.dump(); -#endif //AKANTU_USE_IOHELPER - - akantu::finalize(); - return EXIT_SUCCESS; -} diff --git a/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_triangle_3.cc b/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_triangle_3.cc deleted file mode 100644 index 5bf0d5d8f..000000000 --- a/test/test_mesh_utils/test_facet_extraction/test_facet_extraction_triangle_3.cc +++ /dev/null @@ -1,73 +0,0 @@ -/** - * @file test_facet_extraction_triangle_3.cc - * - * @author Guillaume Anciaux - * @author Marco Vocialta - * - * @date creation: Fri Sep 03 2010 - * @date last modification: Tue Jan 07 2014 - * - * @brief test of internal facet extraction - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014 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 "mesh.hh" -#include "mesh_utils.hh" -#include "material.hh" -/* -------------------------------------------------------------------------- */ -#ifdef AKANTU_USE_IOHELPER -# include "dumper_paraview.hh" -#endif //AKANTU_USE_IOHELPER - -using namespace akantu; - -int main(int argc, char *argv[]) -{ - akantu::initialize(argc, argv); - const ElementType type = _triangle_6; - int dim = ElementClass::getSpatialDimension(); - - Mesh mesh(dim); - mesh.read("square.msh"); - Mesh mesh_facets(mesh.initMeshFacets("mesh_facets")); - - MeshUtils::buildAllFacets(mesh, mesh_facets); - -#ifdef AKANTU_USE_IOHELPER - DumperParaview dumper1("test-facet-extraction"); - dumper1.registerMesh(mesh, dim); - dumper1.dump(); - - DumperParaview dumper2("test-facet-extraction_boundary"); - dumper2.registerMesh(mesh, dim - 1); - dumper2.dump(); - - DumperParaview dumper3("test-facet-extraction_internal"); - dumper3.registerMesh(mesh_facets, dim); - dumper3.dump(); -#endif //AKANTU_USE_IOHELPER - akantu::finalize(); - return EXIT_SUCCESS; -} diff --git a/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt b/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt index e0d81456f..893a085b1 100644 --- a/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt +++ b/test/test_model/test_solid_mechanics_model/test_cohesive/CMakeLists.txt @@ -1,40 +1,39 @@ #=============================================================================== # @file CMakeLists.txt # # @author Marco Vocialta # # @date creation: Tue May 08 2012 # @date last modification: Fri Jun 21 2013 # # @brief configuration for cohesive elements tests # # @section LICENSE # # Copyright (©) 2014 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_akantu_test(test_cohesive_buildfacets "test_cohesive_buildfacets") add_akantu_test(test_cohesive_intrinsic "test_cohesive_intrinsic") add_akantu_test(test_cohesive_extrinsic "test_cohesive_extrinsic") add_akantu_test(test_cohesive_buildfragments "test_cohesive_buildfragments") add_akantu_test(test_cohesive_intrinsic_impl "test_cohesive_intrinsic_impl") add_akantu_test(test_cohesive_1d_element "test_cohesive_1d_element") add_akantu_test(test_cohesive_extrinsic_implicit "test_cohesive_extrinsic_implicit") #=============================================================================== diff --git a/test/test_surface_extraction/CMakeLists.txt b/test/test_surface_extraction/CMakeLists.txt deleted file mode 100644 index f8cd2f36c..000000000 --- a/test/test_surface_extraction/CMakeLists.txt +++ /dev/null @@ -1,47 +0,0 @@ -#=============================================================================== -# @file CMakeLists.txt -# -# @author Leonardo Snozzi -# -# @date creation: Tue Oct 26 2010 -# @date last modification: Tue Nov 06 2012 -# -# @brief configuration for surface extraction tests -# -# @section LICENSE -# -# Copyright (©) 2010-2012, 2014 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(test_surface_extraction_2d_mesh squares.geo 2 1) -register_test(test_surface_extraction_triangle_3 - SOURCES test_surface_extraction_triangle_3.cc - DEPENDENCIES test_surface_extraction_2d_mesh - PACKAGE core - ) - -#=============================================================================== -add_mesh(test_surface_extraction_3d_mesh cubes.geo 3 1) -register_test(test_surface_extraction_tetrahedron_4 - SOURCES test_surface_extraction_tetrahedron_4.cc - DEPENDENCIES test_surface_extraction_3d_mesh - PACKAGE core - ) diff --git a/test/test_surface_extraction/cubes.geo b/test/test_surface_extraction/cubes.geo deleted file mode 100644 index cdd2e3788..000000000 --- a/test/test_surface_extraction/cubes.geo +++ /dev/null @@ -1,74 +0,0 @@ -h = 1; - -Point(1) = {0, 0, 0, h}; -Point(2) = {1, 0, 0, h}; -Point(3) = {1, 1, 0, h}; -Point(4) = {0, 1, 0, h}; -Point(5) = {0, 0, 1, h}; -Point(6) = {1, 0, 1, h}; -Point(7) = {1, 1, 1, h}; -Point(8) = {0, 1, 1, h}; - -Point(9) = {2+0, 0, 0, h}; -Point(10) = {2+1, 0, 0, h}; -Point(11) = {2+1, 1, 0, h}; -Point(12) = {2+0, 1, 0, h}; -Point(13) = {2+0, 0, 1, h}; -Point(14) = {2+1, 0, 1, h}; -Point(15) = {2+1, 1, 1, h}; -Point(16) = {2+0, 1, 1, h}; - -Line(1) = {5, 6}; -Line(2) = {6, 7}; -Line(3) = {7, 8}; -Line(4) = {8, 5}; -Line(5) = {1, 2}; -Line(6) = {2, 3}; -Line(7) = {3, 4}; -Line(8) = {4, 1}; -Line(9) = {5, 1}; -Line(10) = {6, 2}; -Line(11) = {7, 3}; -Line(12) = {8, 4}; -Line(13) = {13, 14}; -Line(14) = {14, 15}; -Line(15) = {15, 16}; -Line(16) = {16, 13}; -Line(17) = {9, 10}; -Line(18) = {10, 11}; -Line(19) = {11, 12}; -Line(20) = {12, 9}; -Line(21) = {13, 9}; -Line(22) = {14, 10}; -Line(23) = {15, 11}; -Line(24) = {16, 12}; - - -Line Loop(25) = {4, 1, 2, 3}; -Plane Surface(26) = {25}; -Line Loop(27) = {7, 8, 5, 6}; -Plane Surface(28) = {27}; -Line Loop(29) = {12, -7, -11, 3}; -Plane Surface(30) = {29}; -Line Loop(31) = {12, 8, -9, -4}; -Plane Surface(32) = {31}; -Line Loop(33) = {1, 10, -5, -9}; -Plane Surface(34) = {33}; -Line Loop(35) = {2, 11, -6, -10}; -Plane Surface(36) = {35}; -Line Loop(37) = {16, 13, 14, 15}; -Plane Surface(38) = {37}; -Line Loop(39) = {20, 17, 18, 19}; -Plane Surface(40) = {39}; -Line Loop(41) = {24, 20, -21, -16}; -Plane Surface(42) = {41}; -Line Loop(43) = {13, 22, -17, -21}; -Plane Surface(44) = {43}; -Line Loop(45) = {14, 23, -18, -22}; -Plane Surface(46) = {45}; -Line Loop(47) = {15, 24, -19, -23}; -Plane Surface(48) = {47}; -Surface Loop(49) = {32, 30, 28, 34, 26, 36}; -Volume(50) = {49}; -Surface Loop(51) = {42, 48, 38, 44, 46, 40}; -Volume(52) = {51}; diff --git a/test/test_surface_extraction/squares.geo b/test/test_surface_extraction/squares.geo deleted file mode 100644 index d2e389681..000000000 --- a/test/test_surface_extraction/squares.geo +++ /dev/null @@ -1,37 +0,0 @@ -// Element size -h = 0.5; - -// Dimension of square -L = 1; - -// ------------------------------------------ -// Geometry -// ------------------------------------------ - -// Points -Point(1) = {0, 0, 0, h}; -Point(2) = {L, 0, 0, h}; -Point(3) = {L, L, 0, h}; -Point(4) = {0, L, 0, h}; - -Point(5) = {1.5*L, 0, 0, h}; -Point(6) = {2.5*L, 0, 0, h}; -Point(7) = {2.5*L, L, 0, h}; -Point(8) = {1.5*L, L, 0, h}; - -// Lines -Line(1) = {4, 1}; -Line(2) = {1, 2}; -Line(3) = {2, 3}; -Line(4) = {3, 4}; - -Line(5) = {8, 5}; -Line(6) = {5, 6}; -Line(7) = {6, 7}; -Line(8) = {7, 8}; - -// Geometric and Physical Surface -Line Loop(1) = {1, 2, 3, 4}; -Line Loop(2) = {5, 6, 7, 8}; -Plane Surface(1) = {1}; -Plane Surface(2) = {2}; diff --git a/test/test_surface_extraction/test_surface_extraction_tetrahedron_4.cc b/test/test_surface_extraction/test_surface_extraction_tetrahedron_4.cc deleted file mode 100644 index d667b447d..000000000 --- a/test/test_surface_extraction/test_surface_extraction_tetrahedron_4.cc +++ /dev/null @@ -1,109 +0,0 @@ -/** - * @file test_surface_extraction_tetrahedron_4.cc - * - * @author Leonardo Snozzi - * @author Marco Vocialta - * - * @date creation: Tue Oct 26 2010 - * @date last modification: Thu Mar 27 2014 - * - * @brief 3d surface extraction tests - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014 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 "mesh.hh" -#include "mesh_io.hh" -#include "mesh_io_msh.hh" -#include "mesh_utils.hh" -#include "solid_mechanics_model.hh" -#include "material.hh" -#include - -#ifdef AKANTU_USE_IOHELPER -# include "io_helper.hh" - -#endif //AKANTU_USE_IOHELPER - -using namespace akantu; - -int main(int argc, char *argv[]) -{ - int dim = 3; - - akantu::initialize(argc, argv); - - Mesh mesh(dim); - MeshIOMSH mesh_io; - mesh_io.read("cubes.msh", mesh); - - MeshUtils::buildFacets(mesh); - - mesh.createBoundaryGroupFromGeometry(); -// MeshUtils::buildSurfaceID(mesh); - - unsigned int nb_nodes = mesh.getNbNodes(); -#ifdef AKANTU_USE_IOHELPER - iohelper::DumperParaview dumper; - dumper.setMode(iohelper::TEXT); - - dumper.setPoints(mesh.getNodes().storage(), dim, nb_nodes, "test-surface-extraction"); - dumper.setConnectivity((int*)mesh.getConnectivity(_tetrahedron_4).storage(), - iohelper::TETRA1, mesh.getNbElement(_tetrahedron_4), iohelper::C_MODE); - dumper.setPrefix("paraview/"); - dumper.init(); - dumper.dump(); - - iohelper::DumperParaview dumper_surface; - dumper_surface.setMode(iohelper::TEXT); - - dumper_surface.setPoints(mesh.getNodes().storage(), dim, nb_nodes, "test-surface-extraction_boundary"); - - dumper_surface.setConnectivity((int *)mesh.getConnectivity(_triangle_3).storage(), - iohelper::TRIANGLE1, mesh.getNbElement(_triangle_3), iohelper::C_MODE); - - UInt * surf_id = new UInt[mesh.getNbElement(_triangle_3)]; - - for(Mesh::const_element_group_iterator it(mesh.element_group_begin()); - it != mesh.element_group_end(); ++it) { - const Array & element_ids = it->second->getElements(_triangle_3); - for(UInt i(0); i << element_ids.getSize(); ++i) { - UInt elem_idx = element_ids(i); - surf_id[elem_idx] = atoi((it->first.c_str())); - } - } - -// for (UInt i = 0; i < mesh.getSurfaceID(_triangle_3).getSize(); ++i) -// surf_id[i] = (double)mesh.getSurfaceID(_triangle_3).storage()[i]; - - dumper_surface.addElemDataField("surface_id", surf_id, 1, mesh.getNbElement(_triangle_3)); - dumper_surface.setPrefix("paraview/"); - dumper_surface.init(); - dumper_surface.dump(); - - delete [] surf_id; -#endif //AKANTU_USE_IOHELPER - - finalize(); - return EXIT_SUCCESS; -} diff --git a/test/test_surface_extraction/test_surface_extraction_triangle_3.cc b/test/test_surface_extraction/test_surface_extraction_triangle_3.cc deleted file mode 100644 index 2b7a57d8e..000000000 --- a/test/test_surface_extraction/test_surface_extraction_triangle_3.cc +++ /dev/null @@ -1,105 +0,0 @@ -/** - * @file test_surface_extraction_triangle_3.cc - * - * @author Leonardo Snozzi - * @author Marco Vocialta - * - * @date creation: Tue Oct 26 2010 - * @date last modification: Thu Mar 27 2014 - * - * @brief test for surface extractions - * - * @section LICENSE - * - * Copyright (©) 2010-2012, 2014 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 "mesh.hh" -#include "mesh_io.hh" -#include "mesh_io_msh.hh" -#include "mesh_utils.hh" -#include "solid_mechanics_model.hh" -#include "material.hh" -#include - -#ifdef AKANTU_USE_IOHELPER -# include "io_helper.hh" - -#endif //AKANTU_USE_IOHELPER - -using namespace akantu; - -int main(int argc, char *argv[]) -{ - int dim = 2; - - akantu::initialize(argc, argv); - - Mesh mesh(dim); - MeshIOMSH mesh_io; - mesh_io.read("squares.msh", mesh); - - MeshUtils::buildFacets(mesh); - mesh.createBoundaryGroupFromGeometry(); - - unsigned int nb_nodes = mesh.getNbNodes(); -#ifdef AKANTU_USE_IOHELPER - iohelper::DumperParaview dumper; - dumper.setMode(iohelper::TEXT); - - dumper.setPoints(mesh.getNodes().storage(), dim, nb_nodes, "test-surface-extraction"); - dumper.setConnectivity((int*)mesh.getConnectivity(_triangle_3).storage(), - iohelper::TRIANGLE1, mesh.getNbElement(_triangle_3), iohelper::C_MODE); - dumper.setPrefix("paraview/"); - dumper.init(); - dumper.dump(); - - iohelper::DumperParaview dumper_surface; - dumper_surface.setMode(iohelper::TEXT); - - dumper_surface.setPoints(mesh.getNodes().storage(), dim, nb_nodes, "test-surface-extraction_boundary"); - - dumper_surface.setConnectivity((int *)mesh.getConnectivity(_segment_2).storage(), - iohelper::LINE1, mesh.getNbElement(_segment_2), iohelper::C_MODE); - UInt * surf_id = new UInt [mesh.getNbElement(_segment_2)]; - - for(Mesh::const_element_group_iterator it(mesh.element_group_begin()); - it != mesh.element_group_end(); ++it) { - const Array & element_ids = it->second->getElements(_segment_2); - for(UInt i(0); i << element_ids.getSize(); ++i) { - UInt elem_idx = element_ids(i); - surf_id[elem_idx] = atoi((it->first.c_str())); - } - } - //for (UInt i = 0; i < mesh.getSurfaceID(_segment_2).getSize(); ++i) - // surf_id[i] = (double)mesh.getSurfaceID(_segment_2).storage()[i]; - - dumper_surface.addElemDataField("surface_id", surf_id, 1, mesh.getNbElement(_segment_2)); - dumper_surface.setPrefix("paraview/"); - dumper_surface.init(); - dumper_surface.dump(); - - delete [] surf_id; -#endif //AKANTU_USE_IOHELPER - - finalize(); - return EXIT_SUCCESS; -}