21 #include "SheafSystem/average_base_space_map_push_action.h" 23 #include "SheafSystem/assert_contract.h" 24 #include "SheafSystem/block.h" 25 #include "SheafSystem/error_message.h" 26 #include "SheafSystem/index_space_iterator.h" 27 #include "SheafSystem/preorder_iterator.h" 28 #include "SheafSystem/sec_vd.h" 29 #include "SheafSystem/section_space_schema_poset.h" 91 #ifdef DIAGNOSTIC_OUTPUT 92 post_information_message(
"Entering average_base_space_map_push_action::operator()");
97 require(xoutputs.
ct() > 0);
98 require(xout_dofs.ct() >= xoutputs.
ct());
99 require_for_all(i, 0, xoutputs.
ct(), xoutputs[i]->state_is_read_accessible());
100 require_for_all(i, 0, xoutputs.
ct(), xout_dofs[i]->ub() >= xoutputs[i]->schema().df());
104 for(
int lout_id = 0; lout_id<xoutputs.
ct(); ++lout_id)
106 sec_vd& loutput = *xoutputs[lout_id];
109 int lout_dofs_ct = _out_dofs[lout_id].ct();
112 int xout_dofs_ct = xout_dofs[lout_id]->ct();
114 loutput.
get_fiber(xitr->disc_id, lout_dofs_base,
117 #ifdef DIAGNOSTIC_OUTPUT 119 cout <<
"disc id: " << setw(4) << xitr->disc_id
120 <<
" _out_dofs: " << _out_dofs[lout_id];
123 for(
int i=0; i<xout_dofs_ct; ++i)
125 xout_dofs_base[i] += lout_dofs_base[i];
128 ++_branch_cts[xitr->disc_id.pod()];
130 #ifdef DIAGNOSTIC_OUTPUT 132 cout <<
" xout_dofs: " << *xout_dofs[lout_id]
133 <<
" ct: " << _branch_cts[xitr->disc_id]
141 ensure(unexecutable(
"xdst_dofs += xdst dofs"));
145 #ifdef DIAGNOSTIC_OUTPUT 147 post_information_message(
"Leaving average_base_space_map_push_action::operator()");
160 require_for_all(i, 0, xoutputs.
ct(), xoutputs[i]->state_is_read_write_accessible());
167 _disc_id_space = &lschema0.discretization().id_space();
169 int lid_ub = lschema0.host()->base_space().member_index_ub().pod();
172 _branch_cts.set_ct(lid_ub);
173 _branch_cts.assign(0);
175 int lct = xoutputs.
ct();
177 _out_dofs.reserve(lct);
178 _out_dofs.set_ct(lct);
180 for(
int i=0; i<lct; ++i)
182 sec_vd& loutput = *xoutputs[i];
193 assign(loutput, 0.0,
false);
210 require_for_all(i, 0, xoutputs.
ct(), xoutputs[i]->state_is_read_write_accessible());
216 for(
int lout_id=0; lout_id<xoutputs.
ct(); ++lout_id)
218 sec_vd& loutput = *xoutputs[lout_id];
221 int lout_dofs_ct = _out_dofs[lout_id].ct();
233 loutput.
get_fiber(lindex, lout_dofs_base,
236 int lbranch_ct = _branch_cts[_disc_id_space->hub_pod(lindex)];
240 for(
int k=0; k<lout_dofs_ct; ++k)
242 lout_dofs_base[k] /= lbranch_ct;
246 loutput.
put_fiber(lindex, lout_dofs_base,
275 require(xother != 0);
303 ensure(is_same_type(result));
318 require(is_ancestor_of(&xother));
360 if(invariant_check())
364 disable_invariant_check();
368 invariance(base_space_map_push_action::invariant());
374 enable_invariant_check();
average_base_space_map_push_action()
Default constructor.
size_type ct() const
The number of items currently in use.
An abstract iterator over the ids of an id space.
pod_type pod() const
The current id in the iteration.
virtual bool invariant() const
Class invariant.
Namespace for fields component of sheaf system.
void get_fiber(pod_index_type xdisc_id, vd_lite &xfiber) const
Sets xfiber to the fiber referred to by discretization id xdisc_id.
virtual void operator()(pullback_map::iterator &xitr, block< sec_vd *> &xoutputs, block< block< sec_vd_dof_type > * > &xout_dofs)
Computes xout_dofs using xitr and the dofs already in xoutputs, as needed.
abstract_poset_member & base()
The restricted base of this section space member (mutable version)
void reserve(index_type xub)
Makes ub() at least xub; if new storage is allocated, it is uninitialized.
virtual average_base_space_map_push_action * clone() const
Virtual constructor, makes a new instance of the same type as this.
Functor to compute the dofs at a output discretization point by averaging the input values from all b...
SHEAF_DLL_SPEC void assign(sec_vd &x0, const sec_vd &x1, bool xauto_access)
Assignment to another section; makes x0 have the same value as x1 on the meet of their bases...
Abstract base class with useful features for all objects.
virtual void initialize(block< sec_vd *> &xoutputs)
Initializes outputs as needed.
bool is_done() const
True if iteration is finished.
void assign(const_reference_type xitem)
Sets the values of all items to xitem.
pointer_type base() const
The underlying storage array.
virtual void release_iterator(index_space_iterator &xitr) const =0
Returns the id space iterator xitr to the iterator pool.
void set_ct(size_type xct)
Sets ct() == xct.
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
virtual index_space_iterator & get_iterator() const =0
Allocates an id space iterator from the iterator pool.
A section of a fiber bundle with a d-dimensional vector space fiber.
virtual void finalize(block< sec_vd *> &xoutputs)
Finalizes outputs as needed.
virtual ~average_base_space_map_push_action()
Destructor.
void put_fiber(pod_index_type xdisc_id, const vd_lite &xfiber)
Sets the fiber referred to by discretization id xdisc_id to xfiber.
const index_space_handle & discretization_id_space() const
The id space for the discretization members in the down set of the base space of this (const version)...
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
Abstract functor to compute the dofs at a destination discretization point.
int_type pod_index_type
The plain old data index type.
A client handle for a poset member which has been prepared for use as a schema for a section space...
virtual average_base_space_map_push_action & operator=(const base_space_map_push_action &xother)
Assignment operator.
int df() const
The dimension of the fiber space component.
double sec_vd_dof_type
The type of degree of freedom in the section space.
An auto_block with a no-initialization initialization policy.