Public Member Functions | Private Member Functions | Private Attributes | List of all members
oomph::HijackedData Class Reference

Custom Data class that is used when HijackingData. The class always contains a single value that is copied from another Data object. More...

#include <nodes.h>

+ Inheritance diagram for oomph::HijackedData:

Public Member Functions

void clear_copied_pointers ()
 Clear the pointers to the copied data. More...
 
 HijackedData (const unsigned &copied_value, Data *const &data_pt)
 Constructor. More...
 
 HijackedData (const Data &data)=delete
 (Shallow) copy constructor More...
 
void operator= (const HijackedData &)=delete
 Broken assignment operator. More...
 
 ~HijackedData ()
 Destructor informs original object that the copy is being deleted and clears its pointers to the stored values. More...
 
bool is_a_copy () const
 Return a boolean to indicate whether the data contains any copied values. Hijacked data is always a copy. More...
 
bool is_a_copy (const unsigned &i) const
 Return a boolean to indicate whether the i-th value is a copied value. Hijacked data is always a copy. More...
 
void assign_eqn_numbers (unsigned long &global_ndof, Vector< double * > &dof_pt)
 HijackedData is always a copy, so no equation numbers should be allocated. This function just returns. More...
 
void resize (const unsigned &n_value)
 We cannot resize HijackedData, so the resize function throws a warning. More...
 
- Public Member Functions inherited from oomph::Data
 Data ()
 Default: Just set pointer to (steady) timestepper. No storage for values is allocated. More...
 
 Data (const unsigned &initial_n_value)
 Default constructor for steady problems: assign memory for initial_n_value values. More...
 
 Data (TimeStepper *const &time_stepper_pt, const unsigned &initial_n_value, const bool &allocate_storage=true)
 Constructor for unsteady problems: assign memory for initial_n_value values and any memory required by the Timestepper for the storage of history values. More...
 
 Data (const Data &data)=delete
 Broken copy constructor. More...
 
void operator= (const Data &)=delete
 Broken assignment operator. More...
 
virtual ~Data ()
 Destructor, deallocates memory assigned for data. More...
 
void set_time_stepper (TimeStepper *const &time_stepper_pt, const bool &preserve_existing_data)
 Set a new timestepper by resizing the appropriate storage. If already assigned the equation numbering will not be altered. More...
 
TimeStepper *& time_stepper_pt ()
 Return the pointer to the timestepper. More...
 
TimeStepper *const & time_stepper_pt () const
 Return the pointer to the timestepper (const version). More...
 
void set_value (const unsigned &i, const double &value_)
 Set the i-th stored data value to specified value. The only reason that we require an explicit set function is because we redefine value() in the Node class to interpolate the values for nodes that are hanging and so we cannot return a reference to the value in this case. More...
 
void set_value (const unsigned &t, const unsigned &i, const double &value_)
 Set the t-th history value of the i-th stored data value to specified value. More...
 
double value (const unsigned &i) const
 Return i-th stored value. This function is not virtual so that it can be inlined. This means that if we have an explicit pointer to a Data object Data* data_pt->value() always returns the "raw" stored value. More...
 
double value (const unsigned &t, const unsigned &i) const
 Return i-th value at time level t (t=0: present, t>0: previous) This function is not virtual so that it can be inlined. This means that if we have an explicit pointer to a Data object Data* data_pt->value() always returns to the "raw" stored value. More...
 
void value (Vector< double > &values) const
 Compute Vector of values for the Data value. More...
 
void value (const unsigned &t, Vector< double > &values) const
 Compute Vector of values (dofs or pinned) in this data at time level t (t=0: present; t>0: previous). More...
 
double * value_pt (const unsigned &i) const
 Return the pointer to the i-the stored value. Typically this is required when direct access to the stored value is required, e.g. when writing functions that return a reference to a variable that is stored in a Data object. More...
 
double * value_pt (const unsigned &t, const unsigned &i) const
 Return the pointer to the i-th stored value, or any of its history values (const version). Typically this is required when direct access to the stored value is required, e.g. when writing functions that return a reference to a variable that is stored in a Data object. More...
 
bool does_pointer_correspond_to_value (double *const &parameter_pt)
 Check whether the pointer parameter_pt addresses internal data values. More...
 
void copy (Data *orig_data_pt)
 Copy Data values from specified Data object. More...
 
void dump (std::ostream &dump_file) const
 Dump the data object to a file. More...
 
void read (std::ifstream &restart_file)
 Read data object from a file. More...
 
long * eqn_number_pt (const unsigned &i)
 Return the pointer to the equation number of the i-th stored variable. More...
 
long & eqn_number (const unsigned &i)
 Return the equation number of the i-th stored variable. More...
 
long eqn_number (const unsigned &i) const
 Return the equation number of the i-th stored variable. More...
 
void pin (const unsigned &i)
 Pin the i-th stored variable. More...
 
void unpin (const unsigned &i)
 Unpin the i-th stored variable. More...
 
void pin_all ()
 Pin all the stored variables. More...
 
void unpin_all ()
 Unpin all the stored variables. More...
 
bool is_pinned (const unsigned &i) const
 Test whether the i-th variable is pinned (1: true; 0: false). More...
 
bool is_segregated_solve_pinned (const unsigned &i)
 Test whether the i-th variable is temporaily pinned for a segregated solve. More...
 
void constrain (const unsigned &i)
 Constrain the i-th stored variable when making hanging data If the data is already pinned leave it along, otherwise mark as constrained (hanging) More...
 
void unconstrain (const unsigned &i)
 Unconstrain the i-th stored variable when make the data nonhanging. Only unconstrain if it was actually constrained (hanging) More...
 
void constrain_all ()
 Constrain all the stored variables when the data is made hanging. More...
 
void unconstrain_all ()
 Unconstrain all the stored variables when the data is made nonhanging. More...
 
bool is_constrained (const unsigned &i)
 Test whether the i-th variable is constrained (1: true; 0: false). More...
 
unsigned self_test ()
 Self-test: Have all values been classified as pinned/unpinned? Return 0 if OK. More...
 
unsigned nvalue () const
 Return number of values stored in data object (incl pinned ones). More...
 
unsigned ntstorage () const
 Return total number of doubles stored per value to record time history of each value (one for steady problems). More...
 
virtual void describe_dofs (std::ostream &out, const std::string &current_string) const
 Function to describe the dofs of the Node. The ostream specifies the output stream to which the description is written; the string stores the currently assembled output that is ultimately written to the output stream by Data::describe_dofs(...); it is typically built up incrementally as we descend through the call hierarchy of this function when called from Problem::describe_dofs(...) More...
 
virtual void add_value_pt_to_map (std::map< unsigned, double * > &map_of_value_pt)
 Add pointers to all unpinned and unconstrained data to a map indexed by (global) equation number. More...
 
void set_halo (const unsigned &non_halo_proc_ID)
 Label the node as halo and specify processor that holds non-halo counterpart. More...
 
void set_nonhalo ()
 Label the node as not being a halo. More...
 
bool is_halo () const
 Is this Data a halo? More...
 
int non_halo_proc_ID ()
 ID of processor ID that holds non-halo counterpart of halo node; negative if not a halo. More...
 
virtual void add_values_to_vector (Vector< double > &vector_of_values)
 Add all data and time history values to the vector in the internal storage order. More...
 
virtual void read_values_from_vector (const Vector< double > &vector_of_values, unsigned &index)
 Read all data and time history values from the vector starting from index. On return the index will be set to the value at the end of the data that has been read in. More...
 
virtual void add_eqn_numbers_to_vector (Vector< long > &vector_of_eqn_numbers)
 Add all equation numbers to the vector in the internal storage order. More...
 
virtual void read_eqn_numbers_from_vector (const Vector< long > &vector_of_eqn_numbers, unsigned &index)
 Read all equation numbers from the vector starting from index. On return the index will be set to the value at the end of the data that has been read in. More...
 

Private Member Functions

void reset_copied_pointers ()
 Reset the pointers to the copied data. More...
 

Private Attributes

DataCopied_data_pt
 Pointer to the Data object from which the value is copied. More...
 
unsigned Copied_index
 Index of the value that is copied from within the Data object. More...
 

Additional Inherited Members

- Static Public Attributes inherited from oomph::Data
static long Is_pinned = -1
 Static "Magic number" used in place of the equation number to indicate that the value is pinned. More...
 
static long Is_segregated_solve_pinned = -3
 Static "Magic number" used in place of the equation number to indicate that the value is pinned, but only for the duration of a segregated solve. More...
 
static long Is_unclassified = -10
 Static "Magic number" used in place of the equation number to denote a value that hasn't been classified as pinned or free. More...
 
static long Is_constrained = -2
 Static "Magic number" used in place of the equation number to indicate that the value is constrained because it is associated with non-conforming element boundaries — a hanging node — (and is therefore pinned) More...
 
- Protected Attributes inherited from oomph::Data
Data ** Copy_of_data_pt
 C-style array of any Data objects that contain copies of the current Data object's data values. More...
 
unsigned Ncopies
 Number of Data that contain copies of this Data object's values. More...
 
- Static Protected Attributes inherited from oomph::Data
static TimeStepperDefault_static_time_stepper_pt = new Steady<0>()
 Default (static) timestepper used in steady problems. More...
 

Detailed Description

Custom Data class that is used when HijackingData. The class always contains a single value that is copied from another Data object.

Definition at line 574 of file nodes.h.

Constructor & Destructor Documentation

◆ HijackedData() [1/2]

oomph::HijackedData::HijackedData ( const unsigned &  copied_value,
Data *const &  data_pt 
)

Constructor.

Constructor, creates a HijackedData object with a single value that is copied from another Data object. The ordering of the aguments is used to distinguish this case from that of copying all data values, except one independent value.

Definition at line 1332 of file nodes.cc.

References oomph::Data::add_copy(), oomph::Data::Eqn_number, oomph::Data::is_a_copy(), and oomph::Data::Value.

◆ HijackedData() [2/2]

oomph::HijackedData::HijackedData ( const Data data)
delete

(Shallow) copy constructor

◆ ~HijackedData()

oomph::HijackedData::~HijackedData ( )
inline

Destructor informs original object that the copy is being deleted and clears its pointers to the stored values.

Definition at line 601 of file nodes.h.

References Copied_data_pt, oomph::Data::Eqn_number, oomph::Data::remove_copy(), and oomph::Data::Value.

Member Function Documentation

◆ assign_eqn_numbers()

void oomph::HijackedData::assign_eqn_numbers ( unsigned long &  global_ndof,
Vector< double * > &  dof_pt 
)
inlinevirtual

HijackedData is always a copy, so no equation numbers should be allocated. This function just returns.

Reimplemented from oomph::Data.

Definition at line 634 of file nodes.h.

◆ clear_copied_pointers()

void oomph::HijackedData::clear_copied_pointers ( )
virtual

Clear the pointers to the copied data.

Reimplemented from oomph::Data.

Definition at line 1318 of file nodes.cc.

References Copied_data_pt, oomph::Data::Eqn_number, and oomph::Data::Value.

◆ is_a_copy() [1/2]

bool oomph::HijackedData::is_a_copy ( ) const
inlinevirtual

Return a boolean to indicate whether the data contains any copied values. Hijacked data is always a copy.

Reimplemented from oomph::Data.

Definition at line 619 of file nodes.h.

◆ is_a_copy() [2/2]

bool oomph::HijackedData::is_a_copy ( const unsigned &  i) const
inlinevirtual

Return a boolean to indicate whether the i-th value is a copied value. Hijacked data is always a copy.

Reimplemented from oomph::Data.

Definition at line 627 of file nodes.h.

◆ operator=()

void oomph::HijackedData::operator= ( const HijackedData )
delete

Broken assignment operator.

◆ reset_copied_pointers()

void oomph::HijackedData::reset_copied_pointers ( )
privatevirtual

Reset the pointers to the copied data.

Reimplemented from oomph::Data.

Definition at line 1304 of file nodes.cc.

References Copied_data_pt, Copied_index, oomph::Data::Eqn_number, and oomph::Data::Value.

◆ resize()

void oomph::HijackedData::resize ( const unsigned &  n_value)
virtual

We cannot resize HijackedData, so the resize function throws a warning.

We do not allow Hijacked Data to be resized.

Reimplemented from oomph::Data.

Definition at line 1363 of file nodes.cc.

Member Data Documentation

◆ Copied_data_pt

Data* oomph::HijackedData::Copied_data_pt
private

Pointer to the Data object from which the value is copied.

Definition at line 578 of file nodes.h.

Referenced by clear_copied_pointers(), reset_copied_pointers(), and ~HijackedData().

◆ Copied_index

unsigned oomph::HijackedData::Copied_index
private

Index of the value that is copied from within the Data object.

Definition at line 581 of file nodes.h.

Referenced by reset_copied_pointers().


The documentation for this class was generated from the following files: