Page MenuHomec4science

vec_akantu.hh
No OneTemporary

File Metadata

Created
Sat, Nov 16, 04:09

vec_akantu.hh

/**
* @file vec_akantu.hh
*
* @author Guillaume Anciaux <guillaume.anciaux@epfl.ch>
*
* @date Mon Jun 16 17:13:26 2014
*
* @brief This is a wrapper to Akantu arrays
*
* @section LICENSE
*
* Copyright (©) 2010-2011 EPFL (Ecole Polytechnique Fédérale de Lausanne)
* Laboratory (LSMS - Laboratoire de Simulation en Mécanique des Solides)
*
* LibMultiScale 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.
*
* LibMultiScale 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 LibMultiScale. If not, see <http://www.gnu.org/licenses/>.
*
*/
#ifndef __LIBMULTISCALE_VEC_AKANTU_HH__
#define __LIBMULTISCALE_VEC_AKANTU_HH__
/* -------------------------------------------------------------------------- */
#include "aka_array.hh"
/* -------------------------------------------------------------------------- */
__BEGIN_LIBMULTISCALE__
class VecAkantu {
/* ------------------------------------------------------------------------ */
/* Constructors/Destructors */
/* ------------------------------------------------------------------------ */
public:
VecAkantu();
VecAkantu(akantu::Array<Real> & vec);
/* ------------------------------------------------------------------------ */
/* Methods */
/* ------------------------------------------------------------------------ */
inline Real & operator()(const UInt i);
inline Real & operator[](const UInt i);
void close();
inline void add(UInt i,Real value);
private:
akantu::Array<Real> * vec;
};
/* -------------------------------------------------------------------------- */
inline VecAkantu::VecAkantu(){
vec = NULL;
}
/* -------------------------------------------------------------------------- */
inline VecAkantu::VecAkantu(akantu::Array<Real> & vec){
this->vec = &vec;
}
/* -------------------------------------------------------------------------- */
inline Real & VecAkantu::operator()(const UInt i){
return vec->storage()[i];
}
/* -------------------------------------------------------------------------- */
inline Real & VecAkantu::operator[](const UInt i){
return vec->storage()[i];
}
/* -------------------------------------------------------------------------- */
inline void VecAkantu::close(){
/// do nothing as long as akantu is used on the base of a ghost element parallelisation
}
/* -------------------------------------------------------------------------- */
inline void VecAkantu::add(UInt i,Real value){
vec->storage()[i] += value;
}
/* -------------------------------------------------------------------------- */
__END_LIBMULTISCALE__
#endif /* __LIBMULTISCALE_VEC_AKANTU_HH__ */

Event Timeline