Loading...
Searching...
No Matches
restrictprolong.hh
// -*- mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
// vi: set et ts=4 sw=4 sts=4:
/*
This file is part of the Open Porous Media project (OPM).
OPM is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
OPM 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 General Public License for more details.
You should have received a copy of the GNU General Public License
along with OPM. If not, see <http://www.gnu.org/licenses/>.
Consult the COPYING file in the top-level source directory of this
module for the precise wording of the license and the list of
copyright holders.
*/
#ifndef EWOMS_COPYRESTRICTPROLONG_HH
#define EWOMS_COPYRESTRICTPROLONG_HH
#include <cassert>
#if HAVE_DUNE_FEM
#include <dune/fem/space/common/restrictprolonginterface.hh>
#endif
namespace Opm {
template <class Grid, class Container>
class CopyRestrictProlong;
template <class Grid, class Container>
struct CopyRestrictProlongTraits
{
using DomainFieldType = typename Grid::ctype;
using RestProlImp = CopyRestrictProlong<Grid, Container>;
};
template<class Grid, class Container>
class CopyRestrictProlong
#if HAVE_DUNE_FEM
: public Dune::Fem::RestrictProlongInterfaceDefault<CopyRestrictProlongTraits<Grid, Container>>
#endif
{
using ThisType = CopyRestrictProlong<Grid, Container>;
Container& container_;
public:
using DomainFieldType = typename Grid::ctype;
explicit CopyRestrictProlong(Container& container)
: container_(container)
{}
template <class Field>
void setFatherChildWeight(const Field&) const
{}
template<class Entity>
void restrictLocal (const Entity& father, const Entity& son, bool initialize) const
{
container_.resize();
assert(container_.codimension() == 0);
if (initialize) {
// copy values from son to father (only once)
container_[father] = container_[son];
}
}
template<class Entity, class LocalGeometry>
void restrictLocal(const Entity& father,
const Entity& son,
const LocalGeometry&,
bool initialize) const
{ restrictLocal(father, son, initialize); }
template<class Entity>
void prolongLocal(const Entity& father,
const Entity& son,
bool) const
{
container_.resize();
assert(container_.codimension() == 0);
// copy values from father to son all sons
container_[son] = container_[father];
}
template<class Entity, class LocalGeometry>
void prolongLocal(const Entity& father,
const Entity& son,
const LocalGeometry&,
bool initialize) const
{ prolongLocal(father, son, initialize); }
template<class Communicator>
void addToList(Communicator&)
{
// TODO
}
template<class LoadBalancer>
void addToLoadBalancer(LoadBalancer&)
{
// TODO
}
};
class EmptyRestrictProlong;
struct EmptyRestrictProlongTraits
{
using DomainFieldType = double;
using RestProlImp = EmptyRestrictProlong;
};
class EmptyRestrictProlong
#if HAVE_DUNE_FEM
: public Dune::Fem::RestrictProlongInterfaceDefault< EmptyRestrictProlongTraits >
#endif
{
using ThisType = EmptyRestrictProlong;
public:
template <class Field>
void setFatherChildWeight(const Field&) const
{}
template<class Entity>
void restrictLocal(const Entity&,
const Entity&,
bool) const
{}
template<class Entity, class LocalGeometry>
void restrictLocal(const Entity&,
const Entity&,
const LocalGeometry&,
bool) const
{}
template<class Entity>
void prolongLocal(const Entity&,
const Entity&,
bool) const
{}
template<class Entity, class LocalGeometry>
void prolongLocal(const Entity&,
const Entity&,
const LocalGeometry&,
bool) const
{}
template<class Communicator>
void addToList(Communicator&)
{}
template<class LoadBalancer>
void addToLoadBalancer(LoadBalancer&)
{}
};
} // namespace Opm
#endif
Opm::CopyRestrictProlong
Definition restrictprolong.hh:49
Opm::CopyRestrictProlong::addToLoadBalancer
void addToLoadBalancer(LoadBalancer &)
add discrete function to load balancer
Definition restrictprolong.hh:124
Opm::CopyRestrictProlong::restrictLocal
void restrictLocal(const Entity &father, const Entity &son, bool initialize) const
restrict data to father
Definition restrictprolong.hh:73
Opm::CopyRestrictProlong::setFatherChildWeight
void setFatherChildWeight(const Field &) const
explicit set volume ratio of son and father
Definition restrictprolong.hh:68
Opm::CopyRestrictProlong::prolongLocal
void prolongLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
prolong data to children
Definition restrictprolong.hh:105
Opm::CopyRestrictProlong::prolongLocal
void prolongLocal(const Entity &father, const Entity &son, bool) const
prolong data to children
Definition restrictprolong.hh:93
Opm::CopyRestrictProlong::restrictLocal
void restrictLocal(const Entity &father, const Entity &son, const LocalGeometry &, bool initialize) const
restrict data to father
Definition restrictprolong.hh:85
Opm::CopyRestrictProlong::addToList
void addToList(Communicator &)
add discrete function to communicator
Definition restrictprolong.hh:115
Opm::EmptyRestrictProlong
Definition restrictprolong.hh:142
Opm::EmptyRestrictProlong::addToList
void addToList(Communicator &)
add discrete function to communicator
Definition restrictprolong.hh:190
Opm::EmptyRestrictProlong::restrictLocal
void restrictLocal(const Entity &, const Entity &, const LocalGeometry &, bool) const
restrict data to father
Definition restrictprolong.hh:165
Opm::EmptyRestrictProlong::prolongLocal
void prolongLocal(const Entity &, const Entity &, const LocalGeometry &, bool) const
prolong data to children
Definition restrictprolong.hh:180
Opm::EmptyRestrictProlong::addToLoadBalancer
void addToLoadBalancer(LoadBalancer &)
add discrete function to load balancer
Definition restrictprolong.hh:197
Opm::EmptyRestrictProlong::setFatherChildWeight
void setFatherChildWeight(const Field &) const
explicit set volume ratio of son and father
Definition restrictprolong.hh:153
Opm::EmptyRestrictProlong::prolongLocal
void prolongLocal(const Entity &, const Entity &, bool) const
prolong data to children
Definition restrictprolong.hh:173
Opm::EmptyRestrictProlong::restrictLocal
void restrictLocal(const Entity &, const Entity &, bool) const
restrict data to father
Definition restrictprolong.hh:158
Opm
This file contains a set of helper functions used by VFPProd / VFPInj.
Definition blackoilbioeffectsmodules.hh:43
Opm::CopyRestrictProlongTraits
Definition restrictprolong.hh:39
Opm::EmptyRestrictProlongTraits
Definition restrictprolong.hh:133