@@ -261,11 +261,11 @@ namespace mgis::behaviour {
261
261
return std::holds_alternative<real>(p->second );
262
262
} // end of isExternalStateVariableUniform
263
263
264
- void update_values (MaterialStateManager& o, const MaterialStateManager& i) {
264
+ void updateValues (MaterialStateManager& o, const MaterialStateManager& i) {
265
265
auto check_size = [](const mgis::size_type s1, const mgis::size_type s2) {
266
266
if (s1 != s2) {
267
267
mgis::raise (
268
- " mgis::behaviour::update_values : "
268
+ " mgis::behaviour::updateValues : "
269
269
" arrays' size does not match" );
270
270
}
271
271
}; // end of check_size
@@ -323,7 +323,7 @@ namespace mgis::behaviour {
323
323
if (std::find_if (b.mps .begin (), b.mps .end (), find_mp) ==
324
324
b.mps .end ()) {
325
325
mgis::raise (
326
- " mgis::behaviour::update_values : "
326
+ " mgis::behaviour::updateValues : "
327
327
" material property '" +
328
328
mp.first +
329
329
" ' defined in the material state manager is not defined "
@@ -333,7 +333,7 @@ namespace mgis::behaviour {
333
333
};
334
334
if (&i.b != &o.b ) {
335
335
mgis::raise (
336
- " mgis::behaviour::update_values : the material state managers "
336
+ " mgis::behaviour::updateValues : the material state managers "
337
337
" do not holds the same behaviour" );
338
338
}
339
339
check_mps (o.b , i.material_properties );
@@ -365,6 +365,61 @@ namespace mgis::behaviour {
365
365
for (const auto & ev : i.external_state_variables ) {
366
366
update_field_holder (o.external_state_variables [ev.first ], ev.second );
367
367
}
368
- } // end of update_values
368
+ } // end of updateValues
369
+
370
+ namespace internals {
371
+
372
+ void extractScalarInternalStateVariable (
373
+ mgis::span<mgis::real> o,
374
+ const mgis::behaviour::MaterialStateManager& s,
375
+ const mgis::size_type offset) {
376
+ const auto stride = s.internal_state_variables_stride ;
377
+ auto * const p = o.data ();
378
+ const auto * const piv = s.internal_state_variables .data () + offset;
379
+ for (mgis::size_type i = 0 ; i != s.n ; ++i) {
380
+ p[i] = piv[i * stride];
381
+ }
382
+ } // end of extractScalarInternalStateVariable
383
+
384
+ void extractInternalStateVariable (
385
+ mgis::span<mgis::real> o,
386
+ const mgis::behaviour::MaterialStateManager& s,
387
+ const mgis::size_type nc,
388
+ const mgis::size_type offset) {
389
+ const auto stride = s.internal_state_variables_stride ;
390
+ auto * p = o.data ();
391
+ const auto * const piv = s.internal_state_variables .data () + offset;
392
+ for (mgis::size_type i = 0 ; i != s.n ; ++i) {
393
+ const auto is = i * stride;
394
+ for (mgis::size_type j = 0 ; j != nc; ++j, ++p) {
395
+ *p = piv[is + j];
396
+ }
397
+ }
398
+ } // end of extractScalarInternalStateVariable
399
+
400
+ } // end of namespace internals
401
+
402
+ void extractInternalStateVariable (
403
+ mgis::span<mgis::real> o,
404
+ const mgis::behaviour::MaterialStateManager& s,
405
+ const mgis::string_view n) {
406
+ const auto & iv = mgis::behaviour::getVariable (s.b .isvs , n);
407
+ const auto nc = mgis::behaviour::getVariableSize (iv, s.b .hypothesis );
408
+ const auto offset =
409
+ mgis::behaviour::getVariableOffset (s.b .isvs , n, s.b .hypothesis );
410
+ // checking compatibility
411
+ if (o.size () != s.n * nc) {
412
+ mgis::raise (
413
+ " extractInternalStateVariable: "
414
+ " unmatched number of integration points" );
415
+ }
416
+ if (nc == 1 ) {
417
+ mgis::behaviour::internals::extractScalarInternalStateVariable (o, s,
418
+ offset);
419
+ } else {
420
+ mgis::behaviour::internals::extractInternalStateVariable (o, s, nc,
421
+ offset);
422
+ }
423
+ } // end of extractInternalStateVariable
369
424
370
425
} // end of namespace mgis::behaviour
0 commit comments