"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "dune/istl/owneroverlapcopy.hh" between
dune-istl-2.6.0.tar.gz and dune-istl-2.7.0.tar.gz

About: dune-istl - DUNE (Distributed and Unified Numerics Environment) is a modular toolbox for solving partial differential equations (PDEs) with grid-based methods: DUNE Iterative Solver Template Library.

owneroverlapcopy.hh  (dune-istl-2.6.0):owneroverlapcopy.hh  (dune-istl-2.7.0)
skipping to change at line 27 skipping to change at line 27
#if HAVE_MPI #if HAVE_MPI
#include <mpi.h> #include <mpi.h>
#endif #endif
#include <dune/common/enumset.hh> #include <dune/common/enumset.hh>
#if HAVE_MPI #if HAVE_MPI
#include <dune/common/parallel/indexset.hh> #include <dune/common/parallel/indexset.hh>
#include <dune/common/parallel/communicator.hh> #include <dune/common/parallel/communicator.hh>
#include <dune/common/parallel/remoteindices.hh> #include <dune/common/parallel/remoteindices.hh>
#include <dune/common/parallel/mpicollectivecommunication.hh> #include <dune/common/parallel/mpicommunication.hh>
#endif #endif
#include "solvercategory.hh" #include "solvercategory.hh"
#include "istlexception.hh" #include "istlexception.hh"
#include <dune/common/parallel/collectivecommunication.hh> #include <dune/common/parallel/communication.hh>
#include <dune/istl/matrixmarket.hh> #include <dune/istl/matrixmarket.hh>
template<int dim, template<class,class> class Comm> template<int dim, template<class,class> class Comm>
void testRedistributed(int s); void testRedistributed(int s);
namespace Dune { namespace Dune {
/** /**
@addtogroup ISTL_Comm @addtogroup ISTL_Comm
@{ @{
*/ */
/** /**
* @file * @file
* @brief Classes providing communication interfaces for * @brief Classes providing communication interfaces for
* overlapping Schwarz methods. * overlapping Schwarz methods.
* @author Peter Bastian * @author Peter Bastian
*/ */
/** /**
* @brief Attribute set for overlapping schwarz. * @brief Attribute set for overlapping Schwarz.
*/ */
struct OwnerOverlapCopyAttributeSet struct OwnerOverlapCopyAttributeSet
{ {
enum AttributeSet { enum AttributeSet {
owner=1, overlap=2, copy=3 owner=1, overlap=2, copy=3
}; };
}; };
/** /**
* @brief Information about the index distribution. * @brief Information about the index distribution.
skipping to change at line 288 skipping to change at line 288
AllSet destFlags; AllSet destFlags;
CopyToAllInterface.build(ri,sourceFlags,destFlags); CopyToAllInterface.build(ri,sourceFlags,destFlags);
CopyToAllInterfaceBuilt = true; CopyToAllInterfaceBuilt = true;
} }
public: public:
/** /**
* @brief Set right Solver Category (default is overlapping). * @brief Set right Solver Category (default is overlapping).
*/ */
void setSolverCategory (SolverCategory set) { void
category = set; DUNE_DEPRECATED_MSG("The solver category can only be set in the constructor.
This method is deprecated and will be removed after Dune 2.7")
setSolverCategory (SolverCategory::Category set) {
category_ = set;
}
SolverCategory::Category
DUNE_DEPRECATED_MSG("This method is deprecated and will be removed after Dun
e 2.7, use category() instead.")
getSolverCategory () const {
return category_;
} }
/** /**
* @brief Get Solver Category. * @brief Get Solver Category.
* @return The Solver Category. * @return The Solver Category.
*/ */
SolverCategory::Category getSolverCategory () const { SolverCategory::Category category () const {
return category; return category_;
} }
const CollectiveCommunication<MPI_Comm>& communicator() const const CollectiveCommunication<MPI_Comm>& communicator() const
{ {
return cc; return cc;
} }
/** /**
* @brief Communicate values from owner data points to all other data points . * @brief Communicate values from owner data points to all other data points .
* *
skipping to change at line 415 skipping to change at line 423
mask[i] = 1; mask[i] = 1;
for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i) for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner) if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
mask[i->local().local()] = 0; mask[i->local().local()] = 0;
} }
result = T2(0.0); result = T2(0.0);
for (typename T1::size_type i=0; i<x.size(); i++) for (typename T1::size_type i=0; i<x.size(); i++)
result += x[i]*(y[i])*mask[i]; result += x[i]*(y[i])*mask[i];
result = cc.sum(result); result = cc.sum(result);
return;
} }
/** /**
* @brief Compute the global euclidian norm of a vector. * @brief Compute the global Euclidean norm of a vector.
* *
* @param x The vector to compute the norm of. * @param x The vector to compute the norm of.
* @return The global euclidian norm of that vector. * @return The global Euclidean norm of that vector.
*/ */
template<class T1> template<class T1>
typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const typename FieldTraits<typename T1::field_type>::real_type norm (const T1& x) const
{ {
using real_type = typename FieldTraits<typename T1::field_type>::real_type
;
// set up mask vector // set up mask vector
if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.si ze())) if (mask.size()!=static_cast<typename std::vector<double>::size_type>(x.si ze()))
{ {
mask.resize(x.size()); mask.resize(x.size());
for (typename std::vector<double>::size_type i=0; i<mask.size(); i++) for (typename std::vector<double>::size_type i=0; i<mask.size(); i++)
mask[i] = 1; mask[i] = 1;
for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i) for (typename PIS::const_iterator i=pis.begin(); i!=pis.end(); ++i)
if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner) if (i->local().attribute()!=OwnerOverlapCopyAttributeSet::owner)
mask[i->local().local()] = 0; mask[i->local().local()] = 0;
} }
typename T1::field_type result = typename T1::field_type(0.0); auto result = real_type(0.0);
for (typename T1::size_type i=0; i<x.size(); i++) for (typename T1::size_type i=0; i<x.size(); i++)
result += x[i].two_norm2()*mask[i]; result += Impl::asVector(x[i]).two_norm2()*mask[i];
return static_cast<double>(sqrt(cc.sum(result))); return sqrt(cc.sum(result));
} }
typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> Copy Flags; typedef Dune::EnumItem<AttributeSet,OwnerOverlapCopyAttributeSet::copy> Copy Flags;
/** @brief The type of the parallel index set. */ /** @brief The type of the parallel index set. */
typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> ParallelIndexSet; typedef Dune::ParallelIndexSet<GlobalIdType,LI,512> ParallelIndexSet;
/** @brief The type of the remote indices. */ /** @brief The type of the remote indices. */
typedef Dune::RemoteIndices<PIS> RemoteIndices; typedef Dune::RemoteIndices<PIS> RemoteIndices;
skipping to change at line 556 skipping to change at line 565
* @param comm_ The MPI Communicator to use, e. g. MPI_COMM_WORLD * @param comm_ The MPI Communicator to use, e. g. MPI_COMM_WORLD
* @param cat_ The Solver category, default is overlapping * @param cat_ The Solver category, default is overlapping
* @param freecomm_ Whether to free the communicator comm_ in the destructor , default is false * @param freecomm_ Whether to free the communicator comm_ in the destructor , default is false
*/ */
OwnerOverlapCopyCommunication (MPI_Comm comm_, OwnerOverlapCopyCommunication (MPI_Comm comm_,
SolverCategory::Category cat_ = SolverCategor y::overlapping, SolverCategory::Category cat_ = SolverCategor y::overlapping,
bool freecomm_ = false) bool freecomm_ = false)
: comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_), : comm(comm_), cc(comm_), pis(), ri(pis,pis,comm_),
OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false), OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt( false), OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt( false),
CopyToAllInterfaceBuilt(false), globalLookup_(0), category(cat_), CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_),
freecomm(freecomm_) freecomm(freecomm_)
{} {}
/** /**
* @brief Construct the communication without any indices using MPI_COMM_WOR LD. * @brief Construct the communication without any indices using MPI_COMM_WOR LD.
* *
* The local index set and the remote indices have to be set up * The local index set and the remote indices have to be set up
* later on. * later on.
* @param cat_ The Solver category, default is overlapping * @param cat_ The Solver category, default is overlapping
is false is false
*/ */
OwnerOverlapCopyCommunication (SolverCategory::Category cat_ = SolverCategor y::overlapping) OwnerOverlapCopyCommunication (SolverCategory::Category cat_ = SolverCategor y::overlapping)
: comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri(pis,pis,MPI_COMM_WOR LD), : comm(MPI_COMM_WORLD), cc(MPI_COMM_WORLD), pis(), ri(pis,pis,MPI_COMM_WOR LD),
OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false), OwnerToAllInterfaceBuilt(false), OwnerOverlapToAllInterfaceBuilt(false),
OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt( false), OwnerCopyToAllInterfaceBuilt(false), OwnerCopyToOwnerCopyInterfaceBuilt( false),
CopyToAllInterfaceBuilt(false), globalLookup_(0), category(cat_), freeco mm(false) CopyToAllInterfaceBuilt(false), globalLookup_(0), category_(cat_), freec omm(false)
{} {}
/** /**
* @brief Constructor * @brief Constructor
* @param indexinfo The set of IndexTripels describing the local and remote indices. * @param indexinfo The set of IndexTripels describing the local and remote indices.
* @param comm_ The communicator to use in the communication. * @param comm_ The communicator to use in the communication.
* @param cat_ The Solver category, default is overlapping * @param cat_ The Solver category, default is overlapping
* @param freecomm_ Whether to free the communicator comm_ in the destructor , default is false * @param freecomm_ Whether to free the communicator comm_ in the destructor , default is false
*/ */
OwnerOverlapCopyCommunication (const IndexInfoFromGrid<GlobalIdType, LocalId Type>& indexinfo, OwnerOverlapCopyCommunication (const IndexInfoFromGrid<GlobalIdType, LocalId Type>& indexinfo,
MPI_Comm comm_, MPI_Comm comm_,
SolverCategory::Category cat_ = SolverCategor y::overlapping, SolverCategory::Category cat_ = SolverCategor y::overlapping,
bool freecomm_ = false) bool freecomm_ = false)
: comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false), : comm(comm_), cc(comm_), OwnerToAllInterfaceBuilt(false),
OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt(fal se), OwnerOverlapToAllInterfaceBuilt(false), OwnerCopyToAllInterfaceBuilt(fal se),
OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false ), OwnerCopyToOwnerCopyInterfaceBuilt(false), CopyToAllInterfaceBuilt(false ),
globalLookup_(0), category(cat_), freecomm(freecomm_) globalLookup_(0), category_(cat_), freecomm(freecomm_)
{ {
// set up an ISTL index set // set up an ISTL index set
pis.beginResize(); pis.beginResize();
for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo. localIndices().end(); ++i) for (localindex_iterator i=indexinfo.localIndices().begin(); i!=indexinfo. localIndices().end(); ++i)
{ {
if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner) if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::owner)
pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSe t::owner,true)); pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSe t::owner,true));
if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap) if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::overlap)
pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSe t::overlap,true)); pis.add(std::get<0>(*i),LI(std::get<1>(*i),OwnerOverlapCopyAttributeSe t::overlap,true));
if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy) if (std::get<2>(*i)==OwnerOverlapCopyAttributeSet::copy)
skipping to change at line 690 skipping to change at line 699
mutable bool OwnerOverlapToAllInterfaceBuilt; mutable bool OwnerOverlapToAllInterfaceBuilt;
mutable IF OwnerCopyToAllInterface; mutable IF OwnerCopyToAllInterface;
mutable bool OwnerCopyToAllInterfaceBuilt; mutable bool OwnerCopyToAllInterfaceBuilt;
mutable IF OwnerCopyToOwnerCopyInterface; mutable IF OwnerCopyToOwnerCopyInterface;
mutable bool OwnerCopyToOwnerCopyInterfaceBuilt; mutable bool OwnerCopyToOwnerCopyInterfaceBuilt;
mutable IF CopyToAllInterface; mutable IF CopyToAllInterface;
mutable bool CopyToAllInterfaceBuilt; mutable bool CopyToAllInterfaceBuilt;
mutable std::vector<double> mask; mutable std::vector<double> mask;
int oldseqNo; int oldseqNo;
GlobalLookupIndexSet* globalLookup_; GlobalLookupIndexSet* globalLookup_;
SolverCategory::Category category; // re-intruduce const qualifier once deprecated setCategory got removed afte
r Dune 2.7
/* const */ SolverCategory::Category category_;
bool freecomm; bool freecomm;
}; };
#endif #endif
/** @} end documentation */ /** @} end documentation */
} // end namespace } // end namespace
#endif #endif
 End of changes. 15 change blocks. 
17 lines changed or deleted 31 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)