SheafSystem  0.0.0.0
section_pusher_push_action.cc
Go to the documentation of this file.
1 
2 //
3 // Copyright (c) 2014 Limit Point Systems, Inc.
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 
20 
21 #include "SheafSystem/section_pusher_push_action.h"
22 
23 #include "SheafSystem/assert_contract.h"
24 #include "SheafSystem/block.h"
25 #include "SheafSystem/error_message.h"
26 #include "SheafSystem/sec_vd.h"
27 
28 using namespace std;
29 using namespace fields; // Workaround for MS C++ bug.
30 
31 // =============================================================================
32 // SECTION_PUSHER_PUSH_ACTION FACET
33 // =============================================================================
34 
35 // PUBLIC MEMBER FUNCTIONS
36 
39 {
40  // Preconditions:
41 
42 
43  // Body:
44 
45  // Nothing to do;
46 
47  // Postconditions:
48 
49  // Exit:
50 
51  return;
52 }
53 
54 int
57 {
58  return _dst_df;
59 }
60 
61 void
63 operator()(pullback_map::iterator& xitr,
64  sec_vd& xdst,
65  block<sec_vd_dof_type>& xdst_dofs)
66 {
67  // Preconditions:
68 
69  require(xdst.state_is_read_accessible());
70  require(xdst.schema().df() == dst_df());
71  require(xdst_dofs.ub() >= dst_df());
72 
73  // Body:
74 
75  is_abstract();
76 
77  // Postconditions:
78 
79 
80  // Exit:
81 
82  return;
83 }
84 
85 void
88 {
89  // Preconditions:
90 
91  require(xdst.state_is_read_write_accessible());
92 
93  // Body:
94 
95  // Default version does nothing.
96 
97  // Postconditions:
98 
99 
100  // Exit:
101 
102  return;
103 }
104 
105 void
108 {
109  // Preconditions:
110 
111  require(xdst.state_is_read_write_accessible());
112 
113  // Body:
114 
115  // Default version does nothing.
116 
117  // Postconditions:
118 
119 
120  // Exit:
121 
122  return;
123 }
124 
125 
126 // PROTECTED MEMBER FUNCTIONS
127 
130 {
131 
132  // Preconditions:
133 
134  // Body:
135 
136  _dst_df = 0;
137 
138  // Postconditions:
139 
140  ensure(invariant());
141  ensure(dst_df() == 0);
142 
143  // Exit:
144 
145  return;
146 }
147 
148 
151 {
152 
153  // Preconditions:
154 
155  require(xdst_df >= 0);
156 
157  // Body:
158 
159  _dst_df = xdst_df;
160 
161  // Postconditions:
162 
163  ensure(invariant());
164  ensure(dst_df() == xdst_df);
165 
166  // Exit:
167 
168  return;
169 }
170 
171 
172 // =============================================================================
173 // ANY FACET
174 // =============================================================================
175 
176 // PUBLIC MEMBER FUNCTIONS
177 
178 bool
180 is_ancestor_of(const any* xother) const
181 {
182 
183  // Preconditions:
184 
185  require(xother != 0);
186 
187  // Body:
188 
189  // True if xother conforms to this.
190 
191  bool result = dynamic_cast<const section_pusher_push_action*>(xother) != 0;
192 
193  // Postconditions:
194 
195  return result;
196 }
197 
200 clone() const
201 {
202  section_pusher_push_action* result = 0;
203 
204  // Preconditions:
205 
206  // Body:
207 
208  is_abstract();
209 
210  // Postconditions:
211 
212  ensure(result != 0);
213  ensure(is_same_type(result));
214 
215  // Exit:
216 
217  return result;
218 }
219 
223 {
224 
225  // Preconditions:
226 
227 
228  // Body:
229 
230  _dst_df = xother._dst_df;
231 
232  // Postconditions:
233 
234  // Exit
235 
236  return *this;
237 }
238 
239 bool
241 invariant() const
242 {
243  bool result = true;
244 
245  if(invariant_check())
246  {
247  // Prevent recursive calls to invariant
248 
249  disable_invariant_check();
250 
251  // Must satisfy base class invariant
252 
253  invariance(any::invariant());
254 
255  // Invariances for this class:
256 
257  // Finished, turn invariant checking back on.
258 
259  enable_invariant_check();
260  }
261 
262  // Exit
263 
264  return result;
265 }
266 
267 
268 // =============================================================================
269 // NON-MEMBER FUNCTIONS
270 // =============================================================================
271 
index_type ub() const
The upper bound on the storage array. The number of items current allocated in the storage array...
Abstract functor to compute the dofs at a destination discretization point.
Namespace for fields component of sheaf system.
bool state_is_read_accessible() const
True if this is attached and if the state is accessible for read or access control is disabled...
STL namespace.
virtual section_pusher_push_action * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
virtual bool invariant() const
Class invariant.
Abstract base class with useful features for all objects.
Definition: any.h:39
bool state_is_read_write_accessible() const
True if this is attached and if the state is accessible for read and write or access control is disab...
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
virtual void finalize(sec_vd &xdst)
Finalizes xdst as needed.
virtual section_pusher_push_action & operator=(const section_pusher_push_action &xother)
Assignment operator.
int _dst_df
The fiber dimension of the destination.
int dst_df()
The fiber dimension of the destination.
A section of a fiber bundle with a d-dimensional vector space fiber.
Definition: sec_vd.h:54
virtual section_space_schema_member & schema()
The restricted schema for this (mutable version).
virtual void initialize(sec_vd &xdst)
Initializes xdst as needed.
int df() const
The dimension of the fiber space component.
virtual void operator()(pullback_map::iterator &xitr, sec_vd &xdst, block< sec_vd_dof_type > &xdst_dofs)=0
Computes xdst_dofs using xitr and the dofs already in xdst, as needed.