SheafSystem  0.0.0.0
copy_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/copy_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 // COPY_BASE_SPACE_MAP_PUSH_ACTION FACET
33 // =============================================================================
34 
35 // PUBLIC MEMBER FUNCTIONS
36 
39 {
40 
41  // Preconditions:
42 
43  // Body:
44 
45  // Nothing to do.
46 
47  // Postconditions:
48 
49  ensure(invariant());
50 
51  // Exit:
52 
53  return;
54 }
55 
56 
59 {
60  // Preconditions:
61 
62 
63  // Body:
64 
65  // Nothing to do;
66 
67  // Postconditions:
68 
69  // Exit:
70 
71  return;
72 }
73 
74 
75 // =============================================================================
76 // BASE_SPACE_MAP_PUSH_ACTION FACET
77 // =============================================================================
78 
79 // PUBLIC MEMBER FUNCTIONS
80 
81 void
83 operator()(pullback_map::iterator& xitr,
84  block<sec_vd*>& xoutputs,
85  block< block<sec_vd_dof_type>* >& xout_dofs)
86 {
87 #ifdef DIAGNOSTIC_OUTPUT
88  post_information_message("Entering copy_base_space_map_push_action::operator()");
89 #endif
90 
91  // Preconditions:
92 
93  require(xoutputs.ct() > 0);
94  require(xout_dofs.ct() >= xoutputs.ct());
95  require_for_all(i, 0, xoutputs.ct(), xoutputs[i]->state_is_read_accessible());
96  require_for_all(i, 0, xoutputs.ct(), xout_dofs[i]->ub() >= xoutputs[i]->schema().df());
97 
98  // Body:
99 
100  // Body:
101 
102  // Do nothing; out dofs already initalized to in dofs.
103 
104  // Postconditions:
105 
106  ensure(unexecutable("xout_dofs unchanged"));
107 
108  // Exit:
109 
110 #ifdef DIAGNOSTIC_OUTPUT
111 
112  post_information_message("Leaving copy_base_space_map_push_action::operator()");
113 #endif
114 
115  return;
116 }
117 
118 
119 // =============================================================================
120 // ANY FACET
121 // =============================================================================
122 
123 // PUBLIC MEMBER FUNCTIONS
124 
125 bool
127 is_ancestor_of(const any* xother) const
128 {
129 
130  // Preconditions:
131 
132  require(xother != 0);
133 
134  // Body:
135 
136  // True if xother conforms to this
137 
138  bool result = dynamic_cast<const copy_base_space_map_push_action*>(xother) != 0;
139 
140  // Postconditions:
141 
142  return result;
143 }
144 
147 clone() const
148 {
150 
151  // Preconditions:
152 
153  // Body:
154 
155  result = new copy_base_space_map_push_action(*this);
156 
157  // Postconditions:
158 
159  ensure(result != 0);
160  ensure(is_same_type(result));
161 
162  // Exit:
163 
164  return result;
165 }
166 
171 {
172 
173  // Preconditions:
174 
175  require(is_ancestor_of(&xother));
176 
177  // Body:
178 
179  not_implemented();
180 
181  // Postconditions:
182 
183  ensure(invariant());
184 
185  // Exit:
186 
187  return *this;
188 }
189 
193 {
194 
195  // Preconditions:
196 
197 
198  // Body:
199 
200  // Nothing to do.
201 
202  // Postconditions:
203 
204  ensure(invariant());
205 
206  // Exit
207 
208  return *this;
209 }
210 
211 bool
213 invariant() const
214 {
215  bool result = true;
216 
217  if(invariant_check())
218  {
219  // Prevent recursive calls to invariant
220 
221  disable_invariant_check();
222 
223  // Must satisfy base class invariant
224 
225  invariance(base_space_map_push_action::invariant());
226 
227  // Invariances for this class:
228 
229  // Finished, turn invariant checking back on.
230 
231  enable_invariant_check();
232  }
233 
234  // Exit
235 
236  return result;
237 }
238 
239 
240 // =============================================================================
241 // NON-MEMBER FUNCTIONS
242 // =============================================================================
243 
size_type ct() const
The number of items currently in use.
Namespace for fields component of sheaf system.
virtual copy_base_space_map_push_action & operator=(const base_space_map_push_action &xother)
Assignment operator.
virtual copy_base_space_map_push_action * clone() const
Virtual constructor, makes a new instance of the same type as this.
STL namespace.
Abstract base class with useful features for all objects.
Definition: any.h:39
virtual bool invariant() const
Class invariant.
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 functor to compute the dofs at a destination discretization point.
Functor to compute the dofs at a destination discretization point by copying the source value to the ...
virtual bool is_ancestor_of(const any *xother) const
Conformance test; true if other conforms to this.
An auto_block with a no-initialization initialization policy.