@@ -47,6 +47,7 @@ namespace libMesh
47
47
template < unsigned int Dim , FEFamily T >
48
48
FE < Dim ,T > ::FE (const FEType & fet ) :
49
49
FEGenericBase < typename FEOutputType < T > ::type > (Dim ,fet ),
50
+ caching (!libMesh ::on_command_line ("-- disable - caching ")),
50
51
last_side (INVALID_ELEM ),
51
52
last_edge (INVALID_ELEM )
52
53
{
@@ -207,13 +208,6 @@ void FE<Dim,T>::reinit(const Elem * elem,
207
208
this -> _fe_map -> template init_reference_to_physical_map < Dim >
208
209
(this -> qrule -> get_points (), elem );
209
210
this -> init_shape_functions (this -> qrule -> get_points (), elem );
210
-
211
- if (this -> shapes_need_reinit ())
212
- {
213
- cached_nodes .resize (elem -> n_nodes ());
214
- for (auto n : elem -> node_index_range ())
215
- cached_nodes [n ] = elem -> point (n );
216
- }
217
211
}
218
212
else
219
213
{
@@ -238,12 +232,16 @@ void FE<Dim,T>::reinit(const Elem * elem,
238
232
this -> _fe_map -> template init_reference_to_physical_map < Dim >
239
233
(this -> qrule -> get_points (), elem );
240
234
this -> init_shape_functions (this -> qrule -> get_points (), elem );
241
- cached_nodes .resize (elem -> n_nodes ());
242
- for (auto n : elem -> node_index_range ())
243
- cached_nodes [n ] = elem -> point (n );
244
235
}
245
236
}
246
237
238
+ if (this -> shapes_need_reinit () && caching && !cached_nodes_still_fit )
239
+ {
240
+ cached_nodes .resize (elem -> n_nodes ());
241
+ for (auto n : elem -> node_index_range ())
242
+ cached_nodes [n ] = elem -> point (n );
243
+ }
244
+
247
245
// The shape functions correspond to the qrule
248
246
this -> shapes_on_quadrature = true;
249
247
}
0 commit comments