Page MenuHomec4science

bem_grid.hh
No OneTemporary

File Metadata

Created
Fri, May 24, 20:41

bem_grid.hh

/**
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2016 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef __BEM_GRID_HH__
#define __BEM_GRID_HH__
/* -------------------------------------------------------------------------- */
#include "surface.hh"
#include "grid.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
// Necessary typedefs for swig
typedef Grid<Real, 2> Grid2dReal;
typedef Grid<complex, 2> Grid2dComplex;
typedef Grid<UInt, 2> Grid2dUInt;
/**
* @brief abstract class for BEMs that use multi component fields
*/
class BemGrid {
public:
/// Constructor
BemGrid(Surface<Real> & surface);
/// Destructor
virtual ~BemGrid();
public:
/* -------------------------------------------------------------------------- */
/* Actual computations */
/* -------------------------------------------------------------------------- */
/// Compute normal vectors to surface
void computeSurfaceNormals();
/// Compute influence coefficients
void computeInfluence();
/// Apply influence fonctions (p -> u)
void applyInfluenceFunctions(Grid<Real, 2> & input, Grid<Real, 2> & output);
/// Apply inverse influence fonctions (u -> p)
void applyInverseInfluenceFunctions(Grid<Real, 2> & input, Grid<Real, 2> & output);
/// Compute true tractions
virtual void computeTrueTractions() = 0;
/// Compute true displacements
virtual void computeTrueDisplacements() = 0;
/// Compute equilibrium
virtual void computeEquilibrium(Real tol, const Grid<Real, 1> & p_target) = 0;
/// Compute displacements
void computeDisplacementsFromTractions();
/// Compute tractions
void computeTractionsFromDisplacements();
/// Compute gaps
void computeGaps(Grid<Real, 2> & disp);
/* -------------------------------------------------------------------------- */
/* Getters */
/* -------------------------------------------------------------------------- */
/// Get influence
const Grid2dComplex & getInfluence() const {return influence;}
/// Get normals
const Grid2dReal & getSurfaceNormals() const {return surface_normals;}
/// Get tractions
const Grid2dReal & getTractions() const {return tractions;}
/// Get displacements
const Grid2dReal & getDisplacements() const {return displacements;}
/// Get true tractions
const Grid2dReal & getTrueTractions() const;
/// Get true displacements
const Grid2dReal & getTrueDisplacements() const;
/// Get gaps
const Grid2dReal & getGaps() const {return gaps;}
/* -------------------------------------------------------------------------- */
/* Setters */
/* -------------------------------------------------------------------------- */
/// Elasticity parameters
void setElasticity(Real E_, Real nu_) {E = E_; nu = nu_;}
/// Max iterations
void setMaxIterations(UInt n) {max_iter = n;}
protected:
/// Elasticity constants
Real E, nu;
/// Max iterations
UInt max_iter;
/// Surface
Surface<Real> & surface;
/// Normal vectors
Grid<Real, 2> surface_normals;
/// Influcence matrices
GridHermitian<Real, 2> influence;
/// Tractions
Grid<Real, 2> tractions;
/// Displacements
Grid<Real, 2> displacements;
/// Gap
Grid<Real, 2> gaps;
/// True tractions
Grid<Real, 2> * true_tractions;
/// True displacements
Grid<Real, 2> * true_displacements;
/// Spectral tractions
GridHermitian<Real, 2> spectral_tractions;
/// Spectral displacements
GridHermitian<Real, 2> spectral_displacements;
};
__END_TAMAAS__
#endif // __BEM_GRID_HH__

Event Timeline