deal.II version GIT relicensing1989gd7a2c90e4e 20241014 01:50:00+00:00

#include <deal.II/algorithms/newton.h>
Public Member Functions  
Newton (OperatorBase &residual, OperatorBase &inverse_derivative)  
void  parse_parameters (ParameterHandler ¶m) 
void  initialize (OutputOperator< VectorType > &output) 
virtual void  operator() (AnyData &out, const AnyData &in) override 
virtual void  notify (const Event &) override 
double  threshold (double new_value) 
void  clear_events () 
template<class Archive >  
void  serialize (Archive &ar, const unsigned int version) 
EnableObserverPointer functionality  
Classes derived from EnableObserverPointer provide a facility to subscribe to this object. This is mostly used by the ObserverPointer class.  
void  subscribe (std::atomic< bool > *const validity, const std::string &identifier="") const 
void  unsubscribe (std::atomic< bool > *const validity, const std::string &identifier="") const 
unsigned int  n_subscriptions () const 
template<typename StreamType >  
void  list_subscribers (StreamType &stream) const 
void  list_subscribers () const 
Static Public Member Functions  
static void  declare_parameters (ParameterHandler ¶m) 
static ::ExceptionBase &  ExcInUse (int arg1, std::string arg2, std::string arg3) 
static ::ExceptionBase &  ExcNoSubscriber (std::string arg1, std::string arg2) 
Public Attributes  
ReductionControl  control 
bool  debug_vectors 
unsigned int  debug 
Protected Attributes  
Event  notifications 
Private Types  
using  map_value_type = decltype(counter_map)::value_type 
using  map_iterator = decltype(counter_map)::iterator 
Private Member Functions  
void  check_no_subscribers () const noexcept 
Private Attributes  
ObserverPointer< OperatorBase, Newton< VectorType > >  residual 
ObserverPointer< OperatorBase, Newton< VectorType > >  inverse_derivative 
ObserverPointer< OutputOperator< VectorType >, Newton< VectorType > >  data_out 
bool  assemble_now 
unsigned int  n_stepsize_iterations 
double  assemble_threshold 
std::atomic< unsigned int >  counter 
std::map< std::string, unsigned int >  counter_map 
std::vector< std::atomic< bool > * >  validity_pointers 
const std::type_info *  object_info 
Static Private Attributes  
static std::mutex  mutex 
Operator class performing Newton's iteration with standard step size control and adaptive matrix generation.
This class performs a Newton iteration up to convergence determined by control. If after an update the norm of the residual has become larger, then step size control is activated and the update is subsequently divided by two until the residual actually becomes smaller (or the minimal scaling factor determined by n_stepsize_iterations is reached).
Since assembling matrices, depending on the implementation, tends to be costly, this method applies an adaptive reassembling strategy. Only if the reduction factor for the residual is more than threshold, the event Algorithms::bad_derivative is submitted to inverse_derivative. It is up to this object to implement reassembling accordingly.
The only value used by the Newton method is the first vector in the parameter out
of operator()(). It serves as the start vector of Newton's method and in the end contains the solution. All other vectors of out
are ignored by Newton's method and its inner Operator objects. All vectors of in
are forwarded to the inner Operator objects, with additional information added as follows.
When calling (*residual)(), the AnyData in
given to the Newton iteration is prepended by a vector "Newton iterate"
, the current value of the Newton iterate, which can be used to evaluate the residual at this point.
For the call to (*inverse_derivative), the vector "Newton
residual"
is inserted before "Newton iterate"
.

privateinherited 
The data type used in counter_map.
Definition at line 231 of file enable_ref_counting_by_observer_pointer.h.

privateinherited 
The iterator type used in counter_map.
Definition at line 236 of file enable_ref_counting_by_observer_pointer.h.
Algorithms::Newton< VectorType >::Newton  (  OperatorBase &  residual, 
OperatorBase &  inverse_derivative  
) 
Constructor, receiving the applications computing the residual and solving the linear problem, respectively.

static 
Declare the parameters applicable to Newton's method.
void Algorithms::Newton< VectorType >::parse_parameters  (  ParameterHandler &  param  ) 
Read the parameters in the ParameterHandler.
void Algorithms::Newton< VectorType >::initialize  (  OutputOperator< VectorType > &  output  ) 
Initialize the pointer data_out for debugging.

overridevirtual 
The actual Newton iteration. The initial value is in out(0)
, which also contains the result after convergence. Values in in
are not used by Newton, but will be handed down to the objects residual and inverse_derivative.
Implements Algorithms::OperatorBase.

overridevirtual 
Register an event triggered by an outer iteration.
Reimplemented from Algorithms::OperatorBase.
double Algorithms::Newton< VectorType >::threshold  (  double  new_value  ) 
Set the maximal residual reduction allowed without triggering assembling in the next step. Return the previous value.

inherited 
Clear all notifications.
Definition at line 46 of file operator.cc.

inherited 
Subscribes a user of the object by storing the pointer validity
. The subscriber may be identified by text supplied as identifier
.
Definition at line 131 of file enable_ref_counting_by_observer.cc.

inherited 
Unsubscribes a user from the object.
identifier
and the validity
pointer must be the same as the one supplied to subscribe(). Definition at line 151 of file enable_ref_counting_by_observer.cc.

inlineinherited 
Return the present number of subscriptions to this object. This allows to use this class for reference counted lifetime determination where the last one to unsubscribe also deletes the object.
Definition at line 315 of file enable_ref_counting_by_observer_pointer.h.

inlineinherited 
List the subscribers to the input stream
.
Definition at line 332 of file enable_ref_counting_by_observer_pointer.h.

inherited 
List the subscribers to deallog
.
Definition at line 199 of file enable_ref_counting_by_observer.cc.

inlineinherited 
Read or write the data of this object to or from a stream for the purpose of serialization using the BOOST serialization library.
This function does not actually serialize any of the member variables of this class. The reason is that what this class stores is only who subscribes to this object, but who does so at the time of storing the contents of this object does not necessarily have anything to do with who subscribes to the object when it is restored. Consequently, we do not want to overwrite the subscribers at the time of restoring, and then there is no reason to write the subscribers out in the first place.
Definition at line 324 of file enable_ref_counting_by_observer_pointer.h.

privatenoexceptinherited 
Check that there are no objects subscribing to this object. If this check passes then it is safe to destroy the current object. It this check fails then this function will either abort or print an error message to deallog (by using the AssertNothrow mechanism), but will not throw an exception.
Definition at line 53 of file enable_ref_counting_by_observer.cc.
ReductionControl Algorithms::Newton< VectorType >::control 

private 

private 

private 

private 

private 

private 
Threshold for reassembling matrix.
If the quotient of two consecutive residuals is smaller than this threshold, the system matrix is not assembled in this step.
The default values is zero, resulting in reassembling in every Newton step.
bool Algorithms::Newton< VectorType >::debug_vectors 
unsigned int Algorithms::Newton< VectorType >::debug 

protectedinherited 
Accumulate events here. If any of those is set, the function solve() of a terminal application must take care of reassembling the matrix.
Definition at line 96 of file operator.h.

mutableprivateinherited 
Store the number of objects which subscribed to this object. Initially, this number is zero, and upon destruction it shall be zero again (i.e. all objects which subscribed should have unsubscribed again).
The creator (and owner) of an object is counted in the map below if HE manages to supply identification.
We use the mutable
keyword in order to allow subscription to constant objects also.
This counter may be read from and written to concurrently in multithreaded code: hence we use the std::atomic
class template.
Definition at line 220 of file enable_ref_counting_by_observer_pointer.h.

mutableprivateinherited 
In this map, we count subscriptions for each different identification string supplied to subscribe().
Definition at line 226 of file enable_ref_counting_by_observer_pointer.h.

mutableprivateinherited 
In this vector, we store pointers to the validity bool in the ObserverPointer objects that subscribe to this class.
Definition at line 242 of file enable_ref_counting_by_observer_pointer.h.

mutableprivateinherited 
Pointer to the typeinfo object of this object, from which we can later deduce the class name. Since this information on the derived class is neither available in the destructor, nor in the constructor, we obtain it in between and store it here.
Definition at line 250 of file enable_ref_counting_by_observer_pointer.h.

staticprivateinherited 
A mutex used to ensure data consistency when accessing the mutable
members of this class. This lock is used in the subscribe() and unsubscribe() functions, as well as in list_subscribers()
.
Definition at line 273 of file enable_ref_counting_by_observer_pointer.h.