8#include <kernel/global/gate.hpp> 
    9#include <kernel/util/math.hpp> 
   10#include <kernel/lafem/container.hpp>  
   66    template<
typename LocalVector_, 
typename Mirror_>
 
   72      typedef typename LocalVector_::DataType DataType;
 
   73      typedef typename LocalVector_::IndexType IndexType;
 
   74      typedef LocalVector_ LocalVectorType;
 
   77      template <
typename LocalVector2_, 
typename Mirror2_ = Mirror_>
 
   81      template <
typename DataType2_, 
typename IndexType2_>
 
   84        typename Mirror_::template MirrorType<DataType2_, IndexType2_> >;
 
  109      template<
typename... Args_>
 
  112        _vector(std::forward<Args_>(args)...)
 
  136      template<
typename OtherGlobalVector_>
 
  137      void convert(
const GateType* gate, 
const OtherGlobalVector_ & other)
 
  140        this->_vector.
convert(other.local());
 
  254      template<LAFEM::Perspective perspective_ = LAFEM::Perspective::pod>
 
  258        return _gate->template get_num_global_dofs<perspective_>();
 
  285        XASSERTM(&(other.local()) != &(this->local()), 
"Trying to self-clone a Global::Vector!");
 
  286        *
this = other.clone(mode);
 
  302      void format(DataType alpha = DataType(0))
 
  350      void axpy(
const Vector& x, 
const DataType alpha = DataType(1))
 
  631        return _vector.get_checkpoint_size(config);
 
  637        _vector.restore_from_checkpoint_data(data);
 
  643        return _vector.set_checkpoint_data(data, config);
 
#define ASSERTM(expr, msg)
Debug-Assertion macro definition with custom message.
#define XASSERTM(expr, msg)
Assertion macro definition with custom message.
Global gate implementation.
void sync_0(LocalVector_ &vector) const
Synchronizes a type-0 vector, resulting in a type-1 vector.
void convert(const Gate< LVT2_, MT2_ > &other)
Conversion function for same vector container type but with different MDI-Type.
const Dist::Comm * get_comm() const
Returns a const pointer to the underlying communicator.
void from_1_to_0(LocalVector_ &vector) const
Converts a type-1 vector into a type-0 vector.
DataType max(DataType x) const
Computes the maximum of a scalar variable over all processes.
ScalarTicketType min_async(DataType x) const
Computes the minimum of a scalar variable over all processes.
ScalarTicketType dot_async(const LocalVector_ &x, const LocalVector_ &y, bool sqrt=false) const
Computes a synchronized dot-product of two type-1 vectors.
ScalarTicketType max_async(DataType x) const
Computes the maximum of a scalar variable over all processes.
void sync_1(LocalVector_ &vector) const
Synchronizes a type-1 vector, resulting in a type-1 vector.
VectorTicketType sync_1_async(LocalVector_ &vector) const
Synchronizes a type-1 vector, resulting in a type-1 vector.
DataType min(DataType x) const
Computes the minimum of a scalar variable over all processes.
VectorTicketType sync_0_async(LocalVector_ &vector) const
Synchronizes a type-0 vector, resulting in a type-1 vector.
DataType dot(const LocalVector_ &x, const LocalVector_ &y) const
Computes a synchronized dot-product of two type-1 vectors.
Ticket class for asynchronous global operations on scalars.
Global vector wrapper class template.
void sync_1()
Performs a type-1 synchronization of the vector, i.e. averages all local DOF contributions.
void format(DataType alpha=DataType(0))
Reset all elements of the container to a given value or zero if missing.
Index size() const
Returns the total number of entries in this distributed vector.
void format(Random &rng, DataType min, DataType max)
Reset all elements of the container to random values.
void component_product(const Vector &x, const Vector &y)
Computes the component-wise product of two vector.
void restore_from_checkpoint_data(std::vector< char > &data)
Extract object from checkpoint.
SynchScalarTicket< DataType > max_abs_element_async() const
Retrieve the absolute maximum value of this vector.
Vector()
standard constructor
const GateType * _gate
a pointer to the gate responsible for synchronization
const Dist::Comm * get_comm() const
Returns a const pointer to the internal communicator of the gate of the vector.
void copy(const Vector &x)
Copies the contents of another vector into this vector.
LocalVector_ _vector
the internal local vector object
DataType dot(const Vector &x) const
Computes the dot-product of this vector and another vector.
const GateType * get_gate() const
Returns a const pointer to the internal gate of the vector.
void from_1_to_0()
Converts a type-1 vector into a type-0 vector.
SynchScalarTicket< DataType > min_abs_element_async() const
Retrieve the absolute minimum value of this vector.
SynchScalarTicket< DataType > norm2sqr_async() const
Computes the squared Euclid norm of this vector.
auto sync_1_async() -> decltype(_gate->sync_1_async(_vector))
Performs a type-1 synchronization of the vector, i.e. averages all local DOF contributions.
SynchScalarTicket< DataType > dot_async(const Vector &x) const
Computes the dot-product of this vector and another vector.
SynchScalarTicket< DataType > norm2_async() const
Computes the Euclid norm of this vector.
DataType max_abs_element() const
Retrieve the absolute maximum value of this vector.
auto sync_0_async() -> decltype(_gate->sync_0_async(_vector))
Performs a type-0 synchronization of the vector, i.e. sums up all local DOF contributions.
Vector clone(LAFEM::CloneMode mode=LAFEM::CloneMode::Weak) const
Creates and returns a clone of this global vector.
SynchScalarTicket< DataType > min_element_async() const
Retrieve the minimum value of this vector.
DataType min_element() const
Retrieve the minimum value of this vector.
DataType min_abs_element() const
Retrieve the absolute minimum value of this vector.
std::uint64_t set_checkpoint_data(std::vector< char > &data, LAFEM::SerialConfig &config)
DataType norm2sqr() const
Computes the squared Euclid norm of this vector.
void component_invert(const Vector &x, const DataType alpha=DataType(1))
Computes the component-wise inverse of a vector.
SynchScalarTicket< DataType > max_element_async() const
Retrieve the maximum value of this vector.
LocalVector_ & local()
Returns a reference to the internal local LAFEM vector object.
std::uint64_t get_checkpoint_size(LAFEM::SerialConfig &config)
Calculate size.
SynchScalarTicket< DataType > max_rel_diff_async(const Vector &x) const
Retrieve the maximum relative difference of this vector and another one y.max_rel_diff(x) returns .
void axpy(const Vector &x, const DataType alpha=DataType(1))
Performs an AXPY operation: this <- this + alpha*x.
DataType norm2() const
Computes the Euclid norm of this vector.
DataType max_element() const
Retrieve the maximum value of this vector.
void scale(const Vector &x, const DataType alpha)
Sets this to a scaled vector: this <- alpha*x.
void sync_0()
Performs a type-0 synchronization of the vector, i.e. sums up all local DOF contributions.
void clone(const Vector &other, LAFEM::CloneMode mode=LAFEM::CloneMode::Weak)
Creates this as a clone of another global vector.
DataType max_rel_diff(const Vector &x) const
Retrieve the maximum relative difference of this vector and another one y.max_rel_diff(x) returns .
void clear()
Clears the underlying vector.
const LocalVector_ & local() const
Returns a const reference to the internal local LAFEM vector object.
Vector(const GateType *gate, Args_ &&... args)
Forwarding constructor.
Config class for serialize parameter.
Pseudo-Random Number Generator.
T_ sqrt(T_ x)
Returns the square-root of a value.
std::uint64_t Index
Index data type.