8#include <kernel/global/gate.hpp> 
    9#include <kernel/global/vector.hpp> 
   23    template<
typename LocalNonlinearFunctional_, 
typename RowMirrorType_, 
typename ColMirrorType_>
 
   28        typedef typename LocalNonlinearFunctional_::DataType 
DataType;
 
   30        typedef typename LocalNonlinearFunctional_::IndexType 
IndexType;
 
   55        static constexpr int BlockHeight = LocalNonlinearFunctional_::BlockHeight;
 
   57        static constexpr int BlockWidth = LocalNonlinearFunctional_::BlockWidth;
 
   82        LocalNonlinearFunctional_& nonlinear_functional) :
 
  114        const LocalNonlinearFunctional_& 
local()
 const 
  255            for(
auto& it : filter.local().template at<0>())
 
  258              auto& slip_filter_vector = it.second.get_filter_vector();
 
  260              if(slip_filter_vector.used_elements() > 0)
 
  265                auto* tmp_elements = tmp.template elements<LAFEM::Perspective::native>();
 
  266                auto* sfv_elements = slip_filter_vector.template elements<LAFEM::Perspective::native>();
 
  269                for(
Index isparse(0); isparse < slip_filter_vector.used_elements(); ++isparse)
 
  271                  Index idense(slip_filter_vector.indices()[isparse]);
 
  272                  tmp_elements[idense] = sfv_elements[isparse];
 
  277                for(
Index isparse(0); isparse < slip_filter_vector.used_elements(); ++isparse)
 
  279                  Index idense(slip_filter_vector.indices()[isparse]);
 
  280                  tmp_elements[idense].normalize();
 
  281                  sfv_elements[isparse] = tmp_elements[idense];
 
  309          return Index(vec_r.norm2sqr());
 
  325          return Index(vec_l.norm2sqr());
 
  342          const bool add_penalty_fval(
false);
 
Global Filter wrapper class template.
Global gate implementation.
void sync_0(LocalVector_ &vector) const
Synchronizes a type-0 vector, resulting in a type-1 vector.
const Dist::Comm * get_comm() const
Returns a const pointer to the underlying communicator.
DataType sum(DataType x) const
Computes a reduced sum over all processes.
Global NonlinearFunctional wrapper class template.
Gate< LocalVectorTypeR, ColMirrorType_ > GateColType
Global Gate for right-vectors.
void set_penalty_param(const DataType fac)
Sets the local functional's penalty parameter.
VectorTypeL create_vector_l() const
Creates an empty left-vector of the correct size.
virtual ~NonlinearFunctional()
Empty virtual destructor.
LocalNonlinearFunctional_::FilterType LocalFilterType
The local functionals filter type.
LocalNonlinearFunctional_ & local()
Gets the local nonlinear functional.
Vector< LocalVectorTypeR, ColMirrorType_ > VectorTypeR
The associated global right-vector type.
DataType get_penalty_param() const
Get the penalty parameter from the local nonlinear functional.
void reset_num_evals()
Resets the evaluation counters.
LocalNonlinearFunctional_::IndexType IndexType
Index type of the local functional.
Index columns()
Gets the number of columns.
Index get_num_func_evals() const
Get the number of times compute_func() was called.
LocalNonlinearFunctional_ & _nonlinear_functional
The underlying local nonlinear functional.
LocalNonlinearFunctional_::VectorTypeL LocalVectorTypeL
The local functionals left-vector type.
NonlinearFunctional(const NonlinearFunctional &)=delete
Explicitly delete copy constructor.
GateColType * _col_gate
Gate for syncing column vectors.
Index rows()
Gets the number of rows.
const LocalNonlinearFunctional_ & local() const
Gets the local nonlinear functional, const version.
Vector< LocalVectorTypeL, RowMirrorType_ > VectorTypeL
The associated global left-vector type.
LocalNonlinearFunctional_::DataType DataType
Floating point data type of the local functional.
void init()
Functionality that cannot be done in the constructor.
void prepare(const VectorTypeR &vec_state, FilterType &filter)
Prepares the operator for evaluation by setting the current state.
VectorTypeR create_vector_r() const
Creates an empty right-vector of the correct size.
void eval_fval_grad(DataType &fval, VectorTypeL &grad)
Computes the functional's value and gradient at the current state.
Filter< LocalFilterType, RowMirrorType_ > FilterType
The associated global filter type.
GateRowType * _row_gate
Gate for syncing row vectors.
const Dist::Comm * get_comm() const
Returns the functional's communicator.
static constexpr int BlockWidth
The global nonlinear functional's Blockwidth ist the same as the local nonlinear functional's.
Index get_num_grad_evals() const
Get the number of times compute_grad() was called.
NonlinearFunctional(GateRowType *row_gate, GateColType *col_gate, LocalNonlinearFunctional_ &nonlinear_functional)
Constructor.
NonlinearFunctional()=delete
Explicitly delete default constructor.
Index get_num_hess_evals() const
Get the number of times compute_hess() was called.
Gate< LocalVectorTypeL, RowMirrorType_ > GateRowType
Global Gate for left-vectors.
LocalNonlinearFunctional_::VectorTypeR LocalVectorTypeR
The local functionals right-vector type.
VectorTypeL GradientType
The a gradient vector is the output of the operators compute_grad() function and thus a left-vector.
DataType get_constraint()
Get the constraint from the local nonlinear functional.
static constexpr int BlockHeight
The global nonlinear functional's Blockheight ist the same as the local nonlinear functional's.
DataType compute_constraint()
Computes the constraint and returns it.
Global vector wrapper class template.
LocalVector_ & local()
Returns a reference to the internal local LAFEM vector object.
T_ sqr(T_ x)
Returns the square of a value.
@ grad
specifies whether the space should supply basis function gradients
std::uint64_t Index
Index data type.