SheafSystem  0.0.0.0
base_space_map_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/base_space_map_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 // BASE_SPACE_MAP_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 void
56 operator()(pullback_map::iterator& xitr,
57  block<sec_vd*>& xoutputs,
58  block< block<sec_vd_dof_type>* >& xout_dofs)
59 {
60  // Preconditions:
61 
62  require(xoutputs.ct() > 0);
63  require(xout_dofs.ct() >= xoutputs.ct());
64  require_for_all(i, 0, xoutputs.ct(), xoutputs[i]->state_is_read_accessible());
65  require_for_all(i, 0, xoutputs.ct(), xout_dofs[i]->ub() >= xoutputs[i]->schema().df());
66 
67  // Body:
68 
69  is_abstract();
70 
71  // Postconditions:
72 
73 
74  // Exit:
75 
76  return;
77 }
78 
79 void
82 {
83  // Preconditions:
84 
85  require(xoutputs.ct() > 0);
86  require_for_all(i, 0, xoutputs.ct(), xoutputs[i]->state_is_read_write_accessible());
87 
88  // Body:
89 
90  // Default version does nothing.
91 
92  // Postconditions:
93 
94 
95  // Exit:
96 
97  return;
98 }
99 
100 void
103 {
104  // Preconditions:
105 
106  require(xoutputs.ct() > 0);
107  require_for_all(i, 0, xoutputs.ct(), xoutputs[i]->state_is_read_write_accessible());
108 
109  // Body:
110 
111  // Default version does nothing.
112 
113  // Postconditions:
114 
115 
116  // Exit:
117 
118  return;
119 }
120 
121 
122 // PROTECTED MEMBER FUNCTIONS
123 
126 {
127 
128  // Preconditions:
129 
130  // Body:
131 
132  // Postconditions:
133 
134  ensure(invariant());
135 
136  // Exit:
137 
138  return;
139 }
140 
141 
142 // =============================================================================
143 // ANY FACET
144 // =============================================================================
145 
146 // PUBLIC MEMBER FUNCTIONS
147 
148 bool
150 is_ancestor_of(const any* xother) const
151 {
152 
153  // Preconditions:
154 
155  require(xother != 0);
156 
157  // Body:
158 
159  // True if xother conforms to this
160 
161  bool result = dynamic_cast<const base_space_map_push_action*>(xother) != 0;
162 
163  // Postconditions:
164 
165  return result;
166 }
167 
170 clone() const
171 {
172  base_space_map_push_action* result = 0;
173 
174  // Preconditions:
175 
176  // Body:
177 
178  is_abstract();
179 
180  // Postconditions:
181 
182  ensure(result != 0);
183  ensure(is_same_type(result));
184 
185  // Exit:
186 
187  return result;
188 }
189 
190 
194 {
195 
196  // Preconditions:
197 
198 
199  // Body:
200 
201  // Nothing to do.
202 
203  // Postconditions:
204 
205  // Exit
206 
207  return *this;
208 }
209 
210 bool
212 invariant() const
213 {
214  bool result = true;
215 
216  if(invariant_check())
217  {
218  // Prevent recursive calls to invariant
219 
220  disable_invariant_check();
221 
222  // Must satisfy base class invariant
223 
224  invariance(any::invariant());
225 
226  // Invariances for this class:
227 
228  // Finished, turn invariant checking back on.
229 
230  enable_invariant_check();
231  }
232 
233  // Exit
234 
235  return result;
236 }
237 
238 
239 // =============================================================================
240 // NON-MEMBER FUNCTIONS
241 // =============================================================================
242 
virtual bool is_ancestor_of(const any *other) const
Conformance test; true if other conforms to this.
virtual base_space_map_push_action * clone() const =0
Virtual constructor, makes a new instance of the same type as this.
size_type ct() const
The number of items currently in use.
Namespace for fields component of sheaf system.
STL namespace.
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual void finalize(block< sec_vd *> &xoutputs)
Finalizes outputs as needed.
virtual bool invariant() const
Class invariant.
virtual void initialize(block< sec_vd *> &xoutputs)
Initializes outputs as needed.
virtual base_space_map_push_action & operator=(const base_space_map_push_action &xother)
Assignment operator.
virtual void operator()(pullback_map::iterator &xitr, block< sec_vd *> &xoutputs, block< block< sec_vd_dof_type > * > &xout_dofs)=0
Computes xout_dofs using xitr and the dofs already in xoutputs, as needed.
Abstract functor to compute the dofs at a destination discretization point.
An auto_block with a no-initialization initialization policy.