diff --git a/src/model/common/non_local_toolbox/non_local_manager.hh b/src/model/common/non_local_toolbox/non_local_manager.hh index c58d89b01..1d6c047eb 100644 --- a/src/model/common/non_local_toolbox/non_local_manager.hh +++ b/src/model/common/non_local_toolbox/non_local_manager.hh @@ -1,277 +1,284 @@ /** * @file non_local_manager.hh * @author Aurelia Isabel Cuba Ramos * @author Nicolas Richart * @date Mon Sep 21 14:21:33 2015 * * @brief Classes that manages all the non-local neighborhoods * * @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 . * */ /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_NON_LOCAL_MANAGER_HH__ #define __AKANTU_NON_LOCAL_MANAGER_HH__ /* -------------------------------------------------------------------------- */ #include "aka_memory.hh" #include "solid_mechanics_model.hh" #include "non_local_neighborhood_base.hh" #include "mesh_events.hh" #include "parsable.hh" /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ class NonLocalManager : public Memory, public Parsable, public MeshEventHandler { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: NonLocalManager(SolidMechanicsModel & model, const ID & id = "non_local_manager", const MemoryID & memory_id = 0); virtual ~NonLocalManager(); typedef std::map NeighborhoodMap; typedef std::pair KeyCOO; /* ------------------------------------------------------------------------ */ /* Methods */ /* ----------------------------------------------------------------------- */ public: /// initialize the non-local manager: compute pair lists and weights for all /// neighborhoods virtual void init(); /// insert new quadrature point in the grid inline void insertQuad(const IntegrationPoint & quad, const Vector & coords, const ID & neighborhood); /// register non-local neighborhood inline void registerNeighborhood(const ID & neighborhood, const ID & weight_func_id); /// associate a non-local variable to a neighborhood void nonLocalVariableToNeighborhood(const ID & id, const ID & neighborhood); /// return the fem object associated with a provided name inline NonLocalNeighborhoodBase & getNeighborhood(const ID & name) const; /// create the grid synchronizers for each neighborhood void createNeighborhoodSynchronizers(); /// compute the weights in each neighborhood for non-local averaging inline void computeWeights(); /// compute the weights in each neighborhood for non-local averaging inline void updatePairLists(); /// register a new non-local material inline void registerNonLocalMaterial(Material & new_mat); /// register a non-local variable inline void registerNonLocalVariable(const ID & variable_name, const ID & nl_variable_name, UInt nb_component); /// average the non-local variables void averageInternals(const GhostType & ghost_type = _not_ghost); /// average the internals and compute the non-local stresses virtual void computeAllNonLocalStresses(); /// register a new internal needed for the weight computations inline ElementTypeMapReal & registerWeightFunctionInternal(const ID & field_name); /// update the flattened version of the weight function internals inline void updateWeightFunctionInternals(); /// get Nb data for synchronization in parallel inline UInt getNbDataForElements(const Array & elements, const ID & id) const; /// pack data for synchronization in parallel inline void packElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag, const ID & id) const; /// unpack data for synchronization in parallel inline void unpackElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag, const ID & id) const; protected: /// create a new neighborhood for a given domain ID void createNeighborhood(const ID & weight_func, const ID & neighborhood); /// flatten the material internal fields needed for the non-local computations void flattenInternal(ElementTypeMapReal & internal_flat, const GhostType & ghost_type, const ElementKind & kind); /// set the values of the jacobians void setJacobians(const FEEngine & fe_engine, const ElementKind & kind); /// allocation of eelment type maps void initElementTypeMap(UInt nb_component, ElementTypeMapReal & element_map, const FEEngine & fe_engine, const ElementKind el_kind = _ek_regular); /// resizing of element type maps void resizeElementTypeMap(UInt nb_component, ElementTypeMapReal & element_map, const FEEngine & fee, const ElementKind el_kind = _ek_regular); /// remove integration points from element type maps void removeIntegrationPointsFromMap( const ElementTypeMapArray & new_numbering, UInt nb_component, ElementTypeMapReal & element_map, const FEEngine & fee, const ElementKind el_kind = _ek_regular); /// allocate the non-local variables void initNonLocalVariables(); /// copy the results of the averaging in the materials void distributeInternals(ElementKind kind); /// cleanup unneccessary ghosts void cleanupExtraGhostElements(ElementTypeMap & nb_ghost_protected); /* ------------------------------------------------------------------------ */ /* MeshEventHandler inherited members */ /* ------------------------------------------------------------------------ */ public: virtual void onElementsRemoved(const Array & element_list, const ElementTypeMapArray & new_numbering, const RemovedElementsEvent & event); virtual void onElementsAdded(const Array & element_list, const NewElementsEvent & event); virtual void onElementsChanged(__attribute__((unused)) const Array & old_elements_list, __attribute__((unused)) const Array & new_elements_list, __attribute__((unused)) const ElementTypeMapArray & new_numbering, __attribute__((unused)) const ChangedElementsEvent & event) {}; virtual void onNodesAdded(__attribute__((unused)) const Array & nodes_list, __attribute__((unused)) const NewNodesEvent & event) {}; virtual void onNodesRemoved(__attribute__((unused)) const Array & nodes_list, __attribute__((unused)) const Array & new_numbering, __attribute__((unused)) const RemovedNodesEvent & event) {}; /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: AKANTU_GET_MACRO(SpatialDimension, spatial_dimension, UInt); AKANTU_GET_MACRO(Model, model, const SolidMechanicsModel &); AKANTU_GET_MACRO_NOT_CONST(Volumes, volumes, ElementTypeMapReal &) AKANTU_GET_MACRO(NbStressCalls, compute_stress_calls, UInt); inline const Array & getJacobians(const ElementType & type, const GhostType & ghost_type) { return *jacobians(type, ghost_type); } /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: /// the non-local neighborhoods present NeighborhoodMap neighborhoods; /// list of all the non-local materials in the model std::vector non_local_materials; struct NonLocalVariable { NonLocalVariable(const ID & variable_name, const ID & nl_variable_name, const ID & id, UInt nb_component) : local(variable_name, id), non_local(nl_variable_name, id), nb_component(nb_component) {} ElementTypeMapReal local; ElementTypeMapReal non_local; UInt nb_component; }; /// the non-local variables associated to a certain neighborhood std::map non_local_variables; /// reference to the model SolidMechanicsModel & model; /// jacobians for all the elements in the mesh ElementTypeMap *> jacobians; /// store the position of the quadrature points ElementTypeMapReal quad_positions; /// store the volume of each quadrature point for the non-local weight /// normalization ElementTypeMapReal volumes; /// the spatial dimension const UInt spatial_dimension; /// counter for computeStress calls UInt compute_stress_calls; /// map to store weight function types from input file std::map weight_function_types; /// map to store the internals needed by the weight functions std::map weight_function_internals; /* -------------------------------------------------------------------------- */ /// the following are members needed to make this processor participate in the /// grid creation of neighborhoods he doesn't own as a member. For details see /// createGridSynchronizers function /// synchronizer registry for dummy grid synchronizers SynchronizerRegistry * dummy_registry; /// map of dummy synchronizers std::map dummy_synchronizers; /// dummy spatial grid SpatialGrid * dummy_grid; /// create a set of all neighborhoods present in the simulation std::set global_neighborhoods; class DummyDataAccessor : public DataAccessor { public: - virtual inline UInt getNbDataForElements() { return 0; }; - virtual inline void packElementData(){}; - virtual inline void unpackElementData(){}; + virtual inline UInt getNbDataForElements(__attribute__((unused)) const Array & elements, + __attribute__((unused)) SynchronizationTag tag) const { return 0; }; + + virtual inline void packElementData(__attribute__((unused)) CommunicationBuffer & buffer, + __attribute__((unused)) const Array & element, + __attribute__((unused)) SynchronizationTag tag) const {}; + + virtual inline void unpackElementData(__attribute__((unused)) CommunicationBuffer & buffer, + __attribute__((unused)) const Array & element, + __attribute__((unused)) SynchronizationTag tag) {}; }; DummyDataAccessor dummy_accessor; }; __END_AKANTU__ /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "non_local_manager_inline_impl.cc" #endif /* __AKANTU_NON_LOCAL_MANAGER_HH__ */ diff --git a/src/model/heat_transfer/heat_transfer_model.hh b/src/model/heat_transfer/heat_transfer_model.hh index 69dfdfc95..b84341028 100644 --- a/src/model/heat_transfer/heat_transfer_model.hh +++ b/src/model/heat_transfer/heat_transfer_model.hh @@ -1,455 +1,455 @@ /** * @file heat_transfer_model.hh * * @author Guillaume Anciaux * @author Lucas Frerot * @author Srinivasa Babu Ramisetti * @author Rui Wang * @author Nicolas Richart * * @date creation: Sun May 01 2011 * @date last modification: Tue Sep 02 2014 * * @brief Model of Heat Transfer * * @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_HEAT_TRANSFER_MODEL_HH__ #define __AKANTU_HEAT_TRANSFER_MODEL_HH__ /* -------------------------------------------------------------------------- */ #include "aka_common.hh" #include "aka_types.hh" #include "aka_voigthelper.hh" #include "aka_memory.hh" #include "model.hh" #include "integrator_gauss.hh" #include "shape_lagrange.hh" #include "dumpable.hh" #include "parsable.hh" #include "solver.hh" #include "generalized_trapezoidal.hh" namespace akantu { class IntegrationScheme1stOrder; } __BEGIN_AKANTU__ struct HeatTransferModelOptions : public ModelOptions { HeatTransferModelOptions(AnalysisMethod analysis_method = _explicit_lumped_capacity ) : analysis_method(analysis_method) {} AnalysisMethod analysis_method; }; extern const HeatTransferModelOptions default_heat_transfer_model_options; class HeatTransferModel : public Model, public DataAccessor, public Parsable { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: typedef FEEngineTemplate MyFEEngineType; HeatTransferModel(Mesh & mesh, UInt spatial_dimension = _all_dimensions, const ID & id = "heat_transfer_model", const MemoryID & memory_id = 0); virtual ~HeatTransferModel() ; /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// generic function to initialize everything ready for explicit dynamics void initFull(const ModelOptions & options = default_heat_transfer_model_options); /// initialize the fem object of the boundary void initFEEngineBoundary(bool create_surface = true); /// read one material file to instantiate all the materials void readMaterials(); /// allocate all vectors void initArrays(); /// register the tags associated with the parallel synchronizer void initParallel(MeshPartition * partition, DataAccessor * data_accessor=NULL); /// initialize the model void initModel(); /// init PBC synchronizer void initPBC(); /// initialize the solver and the jacobian_matrix (called by initImplicit) void initSolver(SolverOptions & solver_options); /// initialize the stuff for the implicit solver void initImplicit(bool dynamic, SolverOptions & solver_options = _solver_no_options); /// function to print the contain of the class virtual void printself(__attribute__ ((unused)) std::ostream & stream, __attribute__ ((unused)) int indent = 0) const {}; /* ------------------------------------------------------------------------ */ /* Methods for explicit */ /* ------------------------------------------------------------------------ */ public: /// compute and get the stable time step Real getStableTimeStep(); /// compute the heat flux void updateResidual(bool compute_conductivity = false); /// calculate the lumped capacity vector for heat transfer problem void assembleCapacityLumped(); /// update the temperature from the temperature rate void explicitPred(); /// update the temperature rate from the increment void explicitCorr(); /// implicit time integration predictor void implicitPred(); /// implicit time integration corrector void implicitCorr(); /// solve the system in temperature rate @f$C\delta \dot T = q_{n+1} - C \dot T_{n}@f$ /// this function needs to be run for dynamics void solveExplicitLumped(); // /// initialize the heat flux // void initializeResidual(Array &temp); // /// initialize temperature // void initializeTemperature(Array &temp); /* ------------------------------------------------------------------------ */ /* Methods for implicit */ /* ------------------------------------------------------------------------ */ public: /** * solve Kt = q **/ void solveStatic(); /// test if the system is converged template bool testConvergence(Real tolerance, Real & error); /** * solve a step (predictor + convergence loop + corrector) using the * the given convergence method (see akantu::SolveConvergenceMethod) * and the given convergence criteria (see * akantu::SolveConvergenceCriteria) **/ template bool solveStep(Real tolerance, UInt max_iteration = 100); template bool solveStep(Real tolerance, Real & error, UInt max_iteration = 100, bool do_not_factorize = false); /// assemble the conductivity matrix void assembleConductivityMatrix(bool compute_conductivity = true); /// assemble the conductivity matrix void assembleCapacity(); /// assemble the conductivity matrix void assembleCapacity(GhostType ghost_type); /// compute the capacity on quadrature points void computeRho(Array & rho, ElementType type, GhostType ghost_type); protected: /// compute A and solve @f[ A\delta u = f_ext - f_int @f] template void solve(Array &increment, Real block_val = 1., bool need_factorize = true, bool has_profile_changed = false); /// computation of the residual for the convergence loop void updateResidualInternal(); private: /// compute the heat flux on ghost types void updateResidual(const GhostType & ghost_type, bool compute_conductivity = false); /// calculate the lumped capacity vector for heat transfer problem (w ghosttype) void assembleCapacityLumped(const GhostType & ghost_type); /// assemble the conductivity matrix (w/ ghost type) template void assembleConductivityMatrix(const GhostType & ghost_type, bool compute_conductivity = true); /// assemble the conductivity matrix template void assembleConductivityMatrix(const ElementType & type, const GhostType & ghost_type, bool compute_conductivity = true); /// compute the conductivity tensor for each quadrature point in an array void computeConductivityOnQuadPoints(const GhostType & ghost_type); /// compute vector k \grad T for each quadrature point void computeKgradT(const GhostType & ghost_type,bool compute_conductivity); /// compute the thermal energy Real computeThermalEnergyByNode(); /* ------------------------------------------------------------------------ */ /* Data Accessor inherited members */ /* ------------------------------------------------------------------------ */ public: inline UInt getNbDataForElements(const Array & elements, SynchronizationTag tag) const; inline void packElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag) const; inline void unpackElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag); inline UInt getNbDataToPack(SynchronizationTag tag) const; inline UInt getNbDataToUnpack(SynchronizationTag tag) const; inline void packData(CommunicationBuffer & buffer, const UInt index, SynchronizationTag tag) const; inline void unpackData(CommunicationBuffer & buffer, const UInt index, SynchronizationTag tag); /* ------------------------------------------------------------------------ */ /* Dumpable interface */ /* ------------------------------------------------------------------------ */ public: virtual dumper::Field * createNodalFieldReal(const std::string & field_name, const std::string & group_name, bool padding_flag); virtual dumper::Field * createNodalFieldBool(const std::string & field_name, const std::string & group_name, bool padding_flag); virtual dumper::Field * createElementalField(const std::string & field_name, const std::string & group_name, bool padding_flag, const UInt & spatial_dimension, const ElementKind & kind); /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: - inline FEEngine & getFEEngineBoundary(std::string name = ""); + inline FEEngine & getFEEngineBoundary(const std::string & name = ""); AKANTU_GET_MACRO(Density, density, Real); AKANTU_GET_MACRO(Capacity, capacity, Real); /// get the dimension of the system space AKANTU_GET_MACRO(SpatialDimension, spatial_dimension, UInt); /// get the current value of the time step AKANTU_GET_MACRO(TimeStep, time_step, Real); /// set the value of the time step AKANTU_SET_MACRO(TimeStep, time_step, Real); /// get the assembled heat flux AKANTU_GET_MACRO(Residual, *residual, Array&); /// get the lumped capacity AKANTU_GET_MACRO(CapacityLumped, *capacity_lumped, Array&); /// get the boundary vector AKANTU_GET_MACRO(BlockedDOFs, *blocked_dofs, Array&); /// get conductivity matrix AKANTU_GET_MACRO(ConductivityMatrix, *conductivity_matrix, const SparseMatrix&); /// get the external heat rate vector AKANTU_GET_MACRO(ExternalHeatRate, *external_heat_rate, Array&); /// get the temperature gradient AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(TemperatureGradient, temperature_gradient, Real); /// get the conductivity on q points AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(ConductivityOnQpoints, conductivity_on_qpoints, Real); /// get the conductivity on q points AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(TemperatureOnQpoints, temperature_on_qpoints, Real); /// internal variables AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(KGradtOnQpoints, k_gradt_on_qpoints, Real); AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(IntBtKgT, int_bt_k_gT, Real); AKANTU_GET_MACRO_BY_ELEMENT_TYPE_CONST(BtKgT, bt_k_gT, Real); /// get the temperature AKANTU_GET_MACRO(Temperature, *temperature, Array &); /// get the temperature derivative AKANTU_GET_MACRO(TemperatureRate, *temperature_rate, Array &); /// get the equation number Array AKANTU_GET_MACRO(EquationNumber, *equation_number, const Array &); /// get the energy denominated by thermal Real getEnergy(const std::string & energy_id, const ElementType & type, UInt index); /// get the energy denominated by thermal Real getEnergy(const std::string & energy_id); /// get the thermal energy for a given element Real getThermalEnergy(const ElementType & type, UInt index); /// get the thermal energy for a given element Real getThermalEnergy(); protected: /* ----------------------------------------------------------------------- */ template void getThermalEnergy(iterator Eth, Array::const_iterator T_it, Array::const_iterator T_end) const; /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ private: /// number of iterations UInt n_iter; IntegrationScheme1stOrder * integrator; /// time step Real time_step; /// temperatures array Array * temperature; /// temperatures derivatives array Array * temperature_rate; /// increment array (@f$\delta \dot T@f$ or @f$\delta T@f$) Array * increment; /// conductivity matrix SparseMatrix * conductivity_matrix; /// capacity matrix SparseMatrix *capacity_matrix; /// jacobian matrix SparseMatrix * jacobian_matrix; /// the density Real density; /// the speed of the changing temperature ElementTypeMapArray temperature_gradient; /// temperature field on quadrature points ElementTypeMapArray temperature_on_qpoints; /// conductivity tensor on quadrature points ElementTypeMapArray conductivity_on_qpoints; /// vector k \grad T on quad points ElementTypeMapArray k_gradt_on_qpoints; /// vector \int \grad N k \grad T ElementTypeMapArray int_bt_k_gT; /// vector \grad N k \grad T ElementTypeMapArray bt_k_gT; /// external flux vector Array * external_heat_rate; /// residuals array Array * residual; /// position of a dof in the K matrix Array * equation_number; //lumped vector Array * capacity_lumped; /// boundary vector Array * blocked_dofs; //realtime Real time; ///capacity Real capacity; //conductivity matrix Matrix conductivity; //linear variation of the conductivity (for temperature dependent conductivity) Real conductivity_variation; // reference temperature for the interpretation of temperature variation Real T_ref; //the biggest parameter of conductivity matrix Real conductivitymax; /// thermal energy by element ElementTypeMapArray thermal_energy; /// Solver Solver * solver; /// analysis method AnalysisMethod method; /// pointer to the pbc synchronizer PBCSynchronizer * pbc_synch; }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #if defined (AKANTU_INCLUDE_INLINE_IMPL) # include "heat_transfer_model_inline_impl.cc" #endif /// standard output stream operator inline std::ostream & operator <<(std::ostream & stream, const HeatTransferModel & _this) { _this.printself(stream); return stream; } __END_AKANTU__ #endif /* __AKANTU_HEAT_TRANSFER_MODEL_HH__ */ diff --git a/src/model/heat_transfer/heat_transfer_model_inline_impl.cc b/src/model/heat_transfer/heat_transfer_model_inline_impl.cc index 0da80104e..00007b56a 100644 --- a/src/model/heat_transfer/heat_transfer_model_inline_impl.cc +++ b/src/model/heat_transfer/heat_transfer_model_inline_impl.cc @@ -1,467 +1,467 @@ /** * @file heat_transfer_model_inline_impl.cc * * @author Guillaume Anciaux * @author Srinivasa Babu Ramisetti * * @date creation: Sun May 01 2011 * @date last modification: Thu Jun 05 2014 * * @brief Implementation of the inline functions of the 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 . * */ /* -------------------------------------------------------------------------- */ -inline FEEngine & HeatTransferModel::getFEEngineBoundary(std::string name) { +inline FEEngine & HeatTransferModel::getFEEngineBoundary(const std::string & name) { return dynamic_cast(getFEEngineClassBoundary(name)); } /* -------------------------------------------------------------------------- */ inline UInt HeatTransferModel::getNbDataToPack(SynchronizationTag tag) const{ AKANTU_DEBUG_IN(); UInt size = 0; UInt nb_nodes = getFEEngine().getMesh().getNbNodes(); switch(tag) { case _gst_htm_temperature: case _gst_htm_capacity: { size += nb_nodes * sizeof(Real); break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } AKANTU_DEBUG_OUT(); return size; } /* -------------------------------------------------------------------------- */ inline UInt HeatTransferModel::getNbDataToUnpack(SynchronizationTag tag) const{ AKANTU_DEBUG_IN(); UInt size = 0; UInt nb_nodes = getFEEngine().getMesh().getNbNodes(); switch(tag) { case _gst_htm_capacity: case _gst_htm_temperature: { size += nb_nodes * sizeof(Real); break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } AKANTU_DEBUG_OUT(); return size; } /* -------------------------------------------------------------------------- */ inline void HeatTransferModel::packData(CommunicationBuffer & buffer, const UInt index, SynchronizationTag tag) const{ AKANTU_DEBUG_IN(); switch(tag) { case _gst_htm_capacity: buffer << (*capacity_lumped)(index); break; case _gst_htm_temperature: { buffer << (*temperature)(index); break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ inline void HeatTransferModel::unpackData(CommunicationBuffer & buffer, const UInt index, SynchronizationTag tag) { AKANTU_DEBUG_IN(); switch(tag) { case _gst_htm_capacity: { buffer >> (*capacity_lumped)(index); break; } case _gst_htm_temperature: { buffer >> (*temperature)(index); break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ inline UInt HeatTransferModel::getNbDataForElements(const Array & elements, SynchronizationTag tag) const { AKANTU_DEBUG_IN(); UInt size = 0; UInt nb_nodes_per_element = 0; Array::const_iterator it = elements.begin(); Array::const_iterator end = elements.end(); for (; it != end; ++it) { const Element & el = *it; nb_nodes_per_element += Mesh::getNbNodesPerElement(el.type); } #ifndef AKANTU_NDEBUG size += elements.getSize() * spatial_dimension * sizeof(Real); /// position of the barycenter of the element (only for check) // size += spatial_dimension * nb_nodes_per_element * sizeof(Real); /// position of the nodes of the element #endif switch(tag) { case _gst_htm_capacity: { size += nb_nodes_per_element * sizeof(Real); // capacity vector break; } case _gst_htm_temperature: { size += nb_nodes_per_element * sizeof(Real); // temperature break; } case _gst_htm_gradient_temperature: { size += getNbIntegrationPoints(elements) * spatial_dimension * sizeof(Real); // temperature gradient size += nb_nodes_per_element * sizeof(Real); // nodal temperatures // size += spatial_dimension * nb_nodes_per_element * sizeof(Real); // shape derivatives break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } AKANTU_DEBUG_OUT(); return size; } /* -------------------------------------------------------------------------- */ inline void HeatTransferModel::packElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag) const { #ifndef AKANTU_NDEBUG Array::const_iterator bit = elements.begin(); Array::const_iterator bend = elements.end(); for (; bit != bend; ++bit) { const Element & element = *bit; Vector barycenter(spatial_dimension); mesh.getBarycenter(element.element, element.type, barycenter.storage(), element.ghost_type); buffer << barycenter; } // packNodalDataHelper(mesh.getNodes(), buffer, elements); #endif switch (tag){ case _gst_htm_capacity: { packNodalDataHelper(*capacity_lumped, buffer, elements, mesh); break; } case _gst_htm_temperature: { packNodalDataHelper(*temperature, buffer, elements, mesh); break; } case _gst_htm_gradient_temperature: { packElementalDataHelper(temperature_gradient, buffer, elements, true, getFEEngine()); packNodalDataHelper(*temperature, buffer, elements, mesh); break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } } /* -------------------------------------------------------------------------- */ inline void HeatTransferModel::unpackElementData(CommunicationBuffer & buffer, const Array & elements, SynchronizationTag tag) { #ifndef AKANTU_NDEBUG Array::const_iterator bit = elements.begin(); Array::const_iterator bend = elements.end(); for (; bit != bend; ++bit) { const Element & element = *bit; Vector barycenter_loc(spatial_dimension); mesh.getBarycenter(element.element, element.type, barycenter_loc.storage(), element.ghost_type); Vector barycenter(spatial_dimension); buffer >> barycenter; Real tolerance = 1e-15; for (UInt i = 0; i < spatial_dimension; ++i) { if(!(std::abs(barycenter(i) - barycenter_loc(i)) <= tolerance)) AKANTU_DEBUG_ERROR("Unpacking an unknown value for the element: " << element << "(barycenter[" << i << "] = " << barycenter_loc(i) << " and buffer[" << i << "] = " << barycenter(i) << ") - tag: " << tag); } } // Vector coords(spatial_dimension); // Real * nodes = getFEEngine().getMesh().getNodes().storage(); // for (UInt n = 0; n < nb_nodes_per_element; ++n) { // buffer >> coords; // UInt offset_conn = conn[el_offset + n]; // Real * coords_local = nodes+spatial_dimension*offset_conn; // for (UInt i = 0; i < spatial_dimension; ++i) { // if(!(std::abs(coords(i) - coords_local[i]) <= tolerance)) // AKANTU_EXCEPTION("Unpacking to wrong node for the element : " // << element // << "(coords[" << i << "] = " << coords_local[i] // << " and buffer[" << i << "] = " << coords(i) << ")"); // } // } #endif switch (tag){ case _gst_htm_capacity: { unpackNodalDataHelper(*capacity_lumped, buffer, elements, mesh); break; } case _gst_htm_temperature: { unpackNodalDataHelper(*temperature, buffer, elements, mesh); break; } case _gst_htm_gradient_temperature: { unpackElementalDataHelper(temperature_gradient, buffer, elements, true, getFEEngine()); unpackNodalDataHelper(*temperature, buffer, elements, mesh); // // Real tolerance = 1e-15; // if (!Math::are_vector_equal(spatial_dimension,gtemp.storage(),it_gtemp[element.element].storage())){ // Real dist = Math::distance_3d(gtemp.storage(), it_gtemp[element.element].storage()); // debug::debugger.getOutputStream().precision(20); // std::stringstream temperatures_str; // temperatures_str.precision(20); // temperatures_str << std::scientific << "temperatures are "; // for (UInt n = 0; n < nb_nodes_per_element; ++n) { // UInt offset_conn = conn[el_offset + n]; // temperatures_str << (*temperature)(offset_conn) << " "; // } // Array::matrix_iterator it_shaped = // const_cast &>(getFEEngine().getShapesDerivatives(element.type, ghost_type)) // .begin(nb_nodes_per_element,spatial_dimension); // AKANTU_EXCEPTION("packed gradient do not match for element " << element.element << std::endl // << "buffer is " << gtemp << " local is " << it_gtemp[element.element] // << " dist is " << dist << std::endl // << temperatures_str.str() << std::endl // << std::scientific << std::setprecision(20) // << " distant temperatures " << temp_nodes // << "temperature gradient size " << temperature_gradient(element.type, ghost_type).getSize() // << " number of ghost elements " << getFEEngine().getMesh().getNbElement(element.type,_ghost) // << std::scientific << std::setprecision(20) // << " shaped " << shaped // << std::scientific << std::setprecision(20) // << " local shaped " << it_shaped[element.element]); // } break; } default: { AKANTU_DEBUG_ERROR("Unknown ghost synchronization tag : " << tag); } } } /* -------------------------------------------------------------------------- */ template bool HeatTransferModel::solveStep(Real tolerance, UInt max_iteration) { Real error = 0.; return this->template solveStep(tolerance, error, max_iteration); } /* -------------------------------------------------------------------------- */ template bool HeatTransferModel::solveStep(Real tolerance, Real & error, UInt max_iteration, bool do_not_factorize) { //EventManager::sendEvent(HeatTransferModelEvent::BeforeSolveStepEvent(method)); this->implicitPred(); this->updateResidual(); AKANTU_DEBUG_ASSERT(conductivity_matrix != NULL, "You should first initialize the implicit solver and assemble the conductivity matrix"); bool need_factorize = !do_not_factorize; if (method == _implicit_dynamic) { AKANTU_DEBUG_ASSERT(capacity_matrix != NULL, "You should first initialize the implicit solver and assemble the mass matrix"); } switch (cmethod) { case _scm_newton_raphson_tangent: case _scm_newton_raphson_tangent_not_computed: break; case _scm_newton_raphson_tangent_modified: this->assembleConductivityMatrix(); break; default: AKANTU_DEBUG_ERROR("The resolution method " << cmethod << " has not been implemented!"); } this->n_iter = 0; bool converged = false; error = 0.; if(criteria == _scc_residual) { converged = this->testConvergence (tolerance, error); if(converged) return converged; } do { if (cmethod == _scm_newton_raphson_tangent) this->assembleConductivityMatrix(); solve(*increment, 1., need_factorize); this->implicitCorr(); if(criteria == _scc_residual) this->updateResidual(); converged = this->testConvergence (tolerance, error); if(criteria == _scc_increment && !converged) this->updateResidual(); // this->dump(); this->n_iter++; AKANTU_DEBUG_INFO("[" << criteria << "] Convergence iteration " << std::setw(std::log10(max_iteration)) << this->n_iter << ": error " << error << (converged ? " < " : " > ") << tolerance); switch (cmethod) { case _scm_newton_raphson_tangent: need_factorize = true; break; case _scm_newton_raphson_tangent_not_computed: case _scm_newton_raphson_tangent_modified: need_factorize = false; break; default: AKANTU_DEBUG_ERROR("The resolution method " << cmethod << " has not been implemented!"); } } while (!converged && this->n_iter < max_iteration); // this makes sure that you have correct strains and stresses after the solveStep function (e.g., for dumping) if(criteria == _scc_increment) this->updateResidual(); if (converged) { //EventManager::sendEvent(HeatTransferModelEvent::AfterSolveStepEvent(method)); } else if(this->n_iter == max_iteration) { AKANTU_DEBUG_WARNING("[" << criteria << "] Convergence not reached after " << std::setw(std::log10(max_iteration)) << this->n_iter << " iteration" << (this->n_iter == 1 ? "" : "s") << "!" << std::endl); } return converged; } /* -------------------------------------------------------------------------- */ template void HeatTransferModel::solve(Array &increment, Real block_val, bool need_factorize, bool has_profile_changed){ updateResidualInternal(); //doesn't do anything for static if(need_factorize) { Real c = 0.,e = 0.; if(method == _static) { AKANTU_DEBUG_INFO("Solving K inc = r"); e = 1.; } else { AKANTU_DEBUG_INFO("Solving (c M + e K) inc = r"); GeneralizedTrapezoidal * trap_int = dynamic_cast(integrator); c = trap_int->getTemperatureRateCoefficient(time_step); e = trap_int->getTemperatureCoefficient(time_step); // std::cout << "c " << c << " e " << e << std::endl; } jacobian_matrix->clear(); // J = c M + e K if(conductivity_matrix) jacobian_matrix->add(*conductivity_matrix, e); if(capacity_matrix) jacobian_matrix->add(*capacity_matrix, c); #if !defined(AKANTU_NDEBUG) // if(capacity_matrix && AKANTU_DEBUG_TEST(dblDump)) capacity_matrix->saveMatrix("M.mtx"); #endif jacobian_matrix->applyBoundary(*blocked_dofs, block_val); #if !defined(AKANTU_NDEBUG) //if(AKANTU_DEBUG_TEST(dblDump)) jacobian_matrix->saveMatrix("J.mtx"); #endif solver->factorize(); } // if (rhs.getSize() != 0) // solver->setRHS(rhs); // else solver->setOperators(); solver->setRHS(*residual); // solve @f[ J \delta w = r @f] solver->solve(increment); UInt nb_nodes = temperature->getSize(); UInt nb_degree_of_freedom = temperature->getNbComponent() * nb_nodes; bool * blocked_dofs_val = blocked_dofs->storage(); Real * increment_val = increment.storage(); for (UInt j = 0; j < nb_degree_of_freedom; ++j,++increment_val, ++blocked_dofs_val) { if ((*blocked_dofs_val)) *increment_val = 0.0; } } /* -------------------------------------------------------------------------- */ diff --git a/src/model/solid_mechanics/materials/material_non_local.cc b/src/model/solid_mechanics/materials/material_non_local.cc index 8fe6e527d..85bae8601 100644 --- a/src/model/solid_mechanics/materials/material_non_local.cc +++ b/src/model/solid_mechanics/materials/material_non_local.cc @@ -1,150 +1,152 @@ /** * @file material_non_local.cc * @author Aurelia Isabel Cuba Ramos * @date Thu Oct 8 15:12:27 2015 * * @brief Implementation of material non-local * * @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 "material_non_local.hh" /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template MaterialNonLocal::MaterialNonLocal(SolidMechanicsModel & model, const ID & id) : Material(model, id) { AKANTU_DEBUG_IN(); NonLocalManager & manager = this->model->getNonLocalManager(); manager.registerNonLocalMaterial(*this); AKANTU_DEBUG_OUT(); } /* -------------------------------------------------------------------------- */ template MaterialNonLocal::~MaterialNonLocal() { } /* -------------------------------------------------------------------------- */ template void MaterialNonLocal::initMaterial() { this->registerNeighborhood(); this->insertQuadsInNeighborhoods(_not_ghost); } /* -------------------------------------------------------------------------- */ template void MaterialNonLocal::insertQuadsInNeighborhoods(GhostType ghost_type) { NonLocalManager & manager = this->model->getNonLocalManager(); - UInt spatial_dimension = this->model->getSpatialDimension(); + UInt _spatial_dimension = this->model->getSpatialDimension(); + AKANTU_DEBUG_ASSERT(_spatial_dimension == spatial_dimension, "This assert was inserted because the current variable shadows a template parameter: cannot know which to use"); + InternalField quadrature_points_coordinates("quadrature_points_coordinates_tmp_nl", *this); quadrature_points_coordinates.initialize(spatial_dimension); /// intialize quadrature point object IntegrationPoint q; q.ghost_type = ghost_type; q.kind = _ek_regular; Mesh::type_iterator it = this->element_filter.firstType(spatial_dimension, ghost_type, _ek_regular); Mesh::type_iterator last_type = this->element_filter.lastType(spatial_dimension, ghost_type, _ek_regular); for(; it != last_type; ++it) { q.type = *it; const Array & elem_filter = this->element_filter(*it, ghost_type); UInt nb_element = elem_filter.getSize(); if(nb_element) { UInt nb_quad = this->fem->getNbIntegrationPoints(*it, ghost_type); UInt nb_tot_quad = nb_quad * nb_element; Array & quads = quadrature_points_coordinates(*it, ghost_type); quads.resize(nb_tot_quad); this->model->getFEEngine().computeIntegrationPointsCoordinates(quads, *it, ghost_type, elem_filter); Array::const_vector_iterator quad = quads.begin(spatial_dimension); UInt * elem = elem_filter.storage(); for (UInt e = 0; e < nb_element; ++e) { q.element = *elem; for (UInt nq = 0; nq < nb_quad; ++nq) { q.num_point = nq; q.global_num = q.element * nb_quad + nq; manager.insertQuad(q, *quad, this->name); ++quad; } ++elem; } } } } /* -------------------------------------------------------------------------- */ template void MaterialNonLocal::updateNonLocalInternals(ElementTypeMapReal & non_local_flattened, const ID & field_id, const UInt nb_component) { for (ghost_type_t::iterator g = ghost_type_t::begin(); g != ghost_type_t::end(); ++g) { GhostType ghost_type = *g; /// loop over all types in the material typedef ElementTypeMapArray:: type_iterator iterator; iterator it = this->element_filter.firstType(spatial_dimension, ghost_type, _ek_regular); iterator last_type = this->element_filter.lastType(spatial_dimension, ghost_type, _ek_regular); for(; it != last_type; ++it) { ElementType el_type = *it; Array & internal = this->getInternal(field_id)(el_type, ghost_type); Array::vector_iterator internal_it = internal.begin(nb_component); Array & internal_flat = non_local_flattened(el_type, ghost_type); Array::const_vector_iterator internal_flat_it = internal_flat.begin(nb_component); /// loop all elements for the given type const Array & filter = this->element_filter(el_type,ghost_type); UInt nb_elements = filter.getSize(); UInt nb_quads = this->getFEEngine().getNbIntegrationPoints(el_type, ghost_type); for (UInt e = 0; e < nb_elements; ++e) { UInt global_el = filter(e); for (UInt q = 0; q < nb_quads; ++q, ++internal_it) { UInt global_quad = global_el * nb_quads + q; *internal_it = internal_flat_it[global_quad]; } } } } } /* -------------------------------------------------------------------------- */ template void MaterialNonLocal::updateResidual(GhostType ghost_type) { AKANTU_EXCEPTION("this method has not been implemented"); } /* -------------------------------------------------------------------------- */ template void MaterialNonLocal::registerNeighborhood() { this->model->getNonLocalManager().registerNeighborhood(this->name, this->name); } /* -------------------------------------------------------------------------- */ INSTANTIATE_MATERIAL(MaterialNonLocal); __END_AKANTU__ diff --git a/src/model/solid_mechanics/materials/material_non_local.hh b/src/model/solid_mechanics/materials/material_non_local.hh index e864fbc0b..61f8d4515 100644 --- a/src/model/solid_mechanics/materials/material_non_local.hh +++ b/src/model/solid_mechanics/materials/material_non_local.hh @@ -1,99 +1,100 @@ /** * @file material_non_local.hh * * @author Nicolas Richart * * @date creation: Wed Aug 31 2011 * @date last modification: Thu Jun 05 2014 * * @brief Material class that handle the non locality of a law for example damage. * * @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 "material.hh" #include "fe_engine.hh" #include "non_local_manager.hh" /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_MATERIAL_NON_LOCAL_HH__ #define __AKANTU_MATERIAL_NON_LOCAL_HH__ __BEGIN_AKANTU__ /* -------------------------------------------------------------------------- */ template class MaterialNonLocal : public virtual Material { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: MaterialNonLocal(SolidMechanicsModel & model, const ID & id = ""); virtual ~MaterialNonLocal(); /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /// initialize the material computed parameter virtual void initMaterial(); virtual void updateResidual(GhostType ghost_type); /// insert the quadrature points in the neighborhoods of the non-local manager virtual void insertQuadsInNeighborhoods(GhostType ghost_type = _not_ghost); /// update the values in the non-local internal fields void updateNonLocalInternals(ElementTypeMapReal & non_local_flattened, const ID & field_id, const UInt nb_component); /// constitutive law virtual void computeNonLocalStresses(GhostType ghost_type = _not_ghost) = 0; /// register the neighborhoods for the material virtual void registerNeighborhood(); protected: - virtual inline void onElementsAdded(const Array & element_list) { + virtual inline void onElementsAdded(const Array & element_list, + const NewElementsEvent & event) { AKANTU_DEBUG_ERROR("This is a case not taken into account!!!"); } /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ protected: }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "material_non_local_inline_impl.cc" __END_AKANTU__ #endif /* __AKANTU_MATERIAL_NON_LOCAL_HH__ */ diff --git a/src/synchronizer/data_accessor.hh b/src/synchronizer/data_accessor.hh index 86838ac20..d9834cfe8 100644 --- a/src/synchronizer/data_accessor.hh +++ b/src/synchronizer/data_accessor.hh @@ -1,267 +1,268 @@ /** * @file data_accessor.hh * * @author Guillaume Anciaux * @author Nicolas Richart * * @date creation: Thu Jun 16 2011 * @date last modification: Thu Jun 05 2014 * * @brief Interface of accessors for pack_unpack system * * @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 . * */ /* -------------------------------------------------------------------------- */ #ifndef __AKANTU_DATA_ACCESSOR_HH__ #define __AKANTU_DATA_ACCESSOR_HH__ /* -------------------------------------------------------------------------- */ #include "aka_common.hh" #include "mesh.hh" #include "fe_engine.hh" #include "communication_buffer.hh" /* -------------------------------------------------------------------------- */ __BEGIN_AKANTU__ class DataAccessor { /* ------------------------------------------------------------------------ */ /* Constructors/Destructors */ /* ------------------------------------------------------------------------ */ public: DataAccessor(); virtual ~DataAccessor(); /* ------------------------------------------------------------------------ */ /* Methods */ /* ------------------------------------------------------------------------ */ public: /** * @brief get the number of data to exchange for a given akantu::Element and a * given akantu::SynchronizationTag */ - virtual UInt getNbDataForElements(__attribute__((unused)) const Array & elements, __attribute__((unused)) SynchronizationTag tag) const { + virtual UInt getNbDataForElements(__attribute__((unused)) const Array & elements, + __attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief get the number of data to exchange for a given degree of freedom and a * given akantu::SynchronizationTag */ virtual UInt getNbDataForDOFs(__attribute__((unused)) const Array & dofs, __attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief get the number of data to send for a given * akantu::SynchronizationTag */ virtual UInt getNbDataToPack(__attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief get the number of data to receive for a given * akantu::SynchronizationTag */ virtual UInt getNbDataToUnpack(__attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief pack the data for a given akantu::Element and a given * akantu::SynchronizationTag */ virtual void packElementData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const Array & element, __attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief pack the data for a given index and a given * akantu::SynchronizationTag */ virtual void packData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const UInt index, __attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief pack the data for the dofs and a given * akantu::SynchronizationTag */ virtual void packDOFData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const Array & dofs, __attribute__((unused)) SynchronizationTag tag) const { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief unpack the data for a given akantu::Element and a given * akantu::SynchronizationTag */ virtual void unpackElementData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const Array & element, __attribute__((unused)) SynchronizationTag tag) { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief unpack the data for a given index and a given * akantu::SynchronizationTag */ virtual void unpackData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const UInt index, __attribute__((unused)) SynchronizationTag tag) { AKANTU_DEBUG_TO_IMPLEMENT(); } /** * @brief unpack the data for the dofs and a given * akantu::SynchronizationTag */ virtual void unpackDOFData(__attribute__((unused)) CommunicationBuffer & buffer, __attribute__((unused)) const Array & dofs, __attribute__((unused)) SynchronizationTag tag) { AKANTU_DEBUG_TO_IMPLEMENT(); } public: template static inline void packNodalDataHelper(const Array & data, CommunicationBuffer & buffer, const Array & elements, const Mesh & mesh) { packUnpackNodalDataHelper(const_cast &>(data), buffer, elements, mesh); } template static inline void unpackNodalDataHelper(Array & data, CommunicationBuffer & buffer, const Array & elements, const Mesh & mesh) { packUnpackNodalDataHelper(data, buffer, elements, mesh); } template static inline void packUnpackNodalDataHelper(Array & data, CommunicationBuffer & buffer, const Array & elements, const Mesh & mesh); template static inline void packUnpackElementalDataHelper(ElementTypeMapArray & data_to_pack, CommunicationBuffer & buffer, const Array & element, bool per_quadrature_point_data, const FEEngine & fem); template static inline void packElementalDataHelper(const ElementTypeMapArray & data_to_pack, CommunicationBuffer & buffer, const Array & elements, bool per_quadrature_point, const FEEngine & fem) { packUnpackElementalDataHelper(const_cast &>(data_to_pack), buffer, elements, per_quadrature_point, fem); } template static inline void unpackElementalDataHelper(ElementTypeMapArray & data_to_unpack, CommunicationBuffer & buffer, const Array & elements, bool per_quadrature_point, const FEEngine & fem) { packUnpackElementalDataHelper(data_to_unpack, buffer, elements, per_quadrature_point, fem); } template static inline void packUnpackDOFDataHelper(Array & data, CommunicationBuffer & buffer, const Array & dofs); template static inline void packDOFDataHelper(const Array & data_to_pack, CommunicationBuffer & buffer, const Array & dofs) { packUnpackDOFDataHelper(const_cast &>(data_to_pack), buffer, dofs); } template static inline void unpackDOFDataHelper(Array & data_to_unpack, CommunicationBuffer & buffer, const Array & dofs) { packUnpackDOFDataHelper(data_to_unpack, buffer, dofs); } /* ------------------------------------------------------------------------ */ /* Accessors */ /* ------------------------------------------------------------------------ */ public: /* ------------------------------------------------------------------------ */ /* Class Members */ /* ------------------------------------------------------------------------ */ private: }; /* -------------------------------------------------------------------------- */ /* inline functions */ /* -------------------------------------------------------------------------- */ #include "data_accessor_inline_impl.cc" // /// standard output stream operator // inline std::ostream & operator <<(std::ostream & stream, const DataAccessor & _this) // { // _this.printself(stream); // return stream; // } __END_AKANTU__ #endif /* __AKANTU_DATA_ACCESSOR_HH__ */