Page MenuHomec4science

elastic_functional.hh
No OneTemporary

File Metadata

Created
Mon, May 13, 05:36

elastic_functional.hh

/**
* @file
*
* @author Lucas Frérot <lucas.frerot@epfl.ch>
*
* @section LICENSE
*
* Copyright (©) 2017 EPFL (Ecole Polytechnique Fédérale de
* Lausanne) Laboratory (LSMS - Laboratoire de Simulation en Mécanique des
* Solides)
*
* Tamaas is free software: you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option) any
* later version.
*
* Tamaas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Tamaas. If not, see <http://www.gnu.org/licenses/>.
*
*/
/* -------------------------------------------------------------------------- */
#ifndef __ELASTIC_FUNCTIONAL_HH__
#define __ELASTIC_FUNCTIONAL_HH__
/* -------------------------------------------------------------------------- */
#include "functional.hh"
#include "model.hh"
#include "tamaas.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_TAMAAS__
namespace functional {
/// Generic functional for elastic energy
class ElasticFunctional : public Functional {
public:
ElasticFunctional(const IntegralOperator& op, const GridBase<Real>& surface)
: Functional(), op(op), surface(surface) {
const Model& model = op.getModel();
buffer = allocateGrid<true, Real>(op.getType(),
model.getBoundaryDiscretization());
}
protected:
const IntegralOperator& op;
const GridBase<Real>& surface;
std::unique_ptr<GridBase<Real>> mutable buffer;
};
/* -------------------------------------------------------------------------- */
/// Functional with pressure as primal field
class ElasticFunctionalPressure : public ElasticFunctional {
public:
using ElasticFunctional::ElasticFunctional;
/// Compute functional with input pressure
Real computeF(GridBase<Real>& pressure, GridBase<Real>& dual) const override;
/// Compute functional gradient with input pressure
void computeGradF(GridBase<Real>& pressure,
GridBase<Real>& gradient) const override;
};
/* -------------------------------------------------------------------------- */
/// Functional with gap as primal field
class ElasticFunctionalGap : public ElasticFunctional {
public:
using ElasticFunctional::ElasticFunctional;
/// Compute functional with input gap
Real computeF(GridBase<Real>& gap, GridBase<Real>& dual) const override;
/// Compute functional gradient with input gap
void computeGradF(GridBase<Real>& gap,
GridBase<Real>& gradient) const override;
};
} // namespace functional
__END_TAMAAS__
/* -------------------------------------------------------------------------- */
#endif // __ELASTIC_FUNCTIONAL_HH__

Event Timeline