Arcane  v3.16.3.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
MeshMaterialTesterModule.cc
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2025 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4// See the top-level COPYRIGHT file for details.
5// SPDX-License-Identifier: Apache-2.0
6//-----------------------------------------------------------------------------
7/*---------------------------------------------------------------------------*/
8/* MeshMaterialTesterModule.cc (C) 2000-2025 */
9/* */
10/* Module de test du gestionnaire des matériaux. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/tests/MeshMaterialTesterModule.h"
15
16#include "arcane/utils/List.h"
17#include "arcane/utils/OStringStream.h"
18#include "arcane/utils/ValueChecker.h"
19#include "arcane/utils/SimdOperation.h"
20
21#include "arcane/core/ITimeLoopMng.h"
22#include "arcane/core/ITimeLoop.h"
23#include "arcane/core/TimeLoopEntryPointInfo.h"
24#include "arcane/core/IMesh.h"
25#include "arcane/core/IItemFamily.h"
26#include "arcane/core/ItemPrinter.h"
27#include "arcane/core/IParallelMng.h"
28#include "arcane/core/IMeshModifier.h"
29#include "arcane/core/IMeshUtilities.h"
30#include "arcane/core/IMeshPartitioner.h"
31#include "arcane/core/VariableDependInfo.h"
34
35#include "arcane/core/materials/IMeshMaterialMng.h"
36#include "arcane/core/materials/IMeshMaterial.h"
37#include "arcane/core/materials/IMeshEnvironment.h"
38#include "arcane/core/materials/IMeshBlock.h"
39#include "arcane/core/materials/MaterialVariableBuildInfo.h"
40#include "arcane/core/materials/CellToAllEnvCellConverter.h"
41#include "arcane/core/materials/internal/IMeshMaterialMngInternal.h"
42
43#include "arcane/materials/MeshMaterialModifier.h"
44#include "arcane/materials/MeshBlockBuildInfo.h"
45#include "arcane/materials/MeshEnvironmentBuildInfo.h"
46#include "arcane/materials/MeshMaterialVariableDependInfo.h"
47#include "arcane/materials/MatCellVector.h"
48#include "arcane/materials/EnvCellVector.h"
49#include "arcane/materials/MatConcurrency.h"
50#include "arcane/materials/MeshMaterialIndirectModifier.h"
51#include "arcane/materials/MeshMaterialVariableSynchronizerList.h"
53#include "arcane/materials/MeshMaterialInfo.h"
54
55#include "arcane/accelerator/core/RunQueue.h"
56
57// Inclut le .cc pour avoir la définition des méthodes templates
58#include "arcane/tests/StdMeshVariables.cc"
59
60#include <functional>
61#include <atomic>
62#include <map>
63
64/*---------------------------------------------------------------------------*/
65/*---------------------------------------------------------------------------*/
66
67namespace ArcaneTest
68{
69
70/*---------------------------------------------------------------------------*/
71/*---------------------------------------------------------------------------*/
72
73void MeshMaterialTesterModule::
74_checkRunQueues()
75{
76 info() << "Test checkRunQueues";
77 IMeshMaterialMngInternal* mng = m_material_mng->_internalApi();
78 eExecutionPolicy mng_policy = mng->runQueue().executionPolicy();
79 eExecutionPolicy def_policy = mng->runQueue(eExecutionPolicy::None).executionPolicy();
80 eExecutionPolicy seq_policy = mng->runQueue(eExecutionPolicy::Sequential).executionPolicy();
81 eExecutionPolicy thread_policy = mng->runQueue(eExecutionPolicy::Thread).executionPolicy();
82
83 if (def_policy != mng_policy)
84 ARCANE_FATAL("Bad default execution policy '{0}' '{1}'", def_policy, mng_policy);
85 if (seq_policy != eExecutionPolicy::Sequential)
86 ARCANE_FATAL("Bad sequential execution policy '{0}'", seq_policy);
87 if (thread_policy != eExecutionPolicy::Thread)
88 ARCANE_FATAL("Bad thread execution policy '{0}'", thread_policy);
89}
90
91/*---------------------------------------------------------------------------*/
92/*---------------------------------------------------------------------------*/
93
94void MeshMaterialTesterModule::
95_checkNullComponentItem()
96{
97 EnvCell null_env_cell;
98 info() << "NullEnvCell global_cell_id=" << null_env_cell.globalCell().localId();
99
100 info() << "NullEnvCell var_index =" << null_env_cell._varIndex();
101 //info() << "NullEnvCell component =" << null_env_cell.component();
102 info() << "NullEnvCell component_id =" << null_env_cell.componentId();
103 info() << "NullEnvCell null =" << null_env_cell.null();
104 info() << "NullEnvCell super_cell =" << null_env_cell.superCell();
105 info() << "NullEnvCell level =" << null_env_cell.level();
106 info() << "NullEnvCell nb_sub_item=" << null_env_cell.nbSubItem();
107 info() << "NullEnvCell component_unique_id=" << null_env_cell.componentUniqueId();
108 //info() << "NullEnvCell sub_items =" << null_env_cell.subItems();
109
110 info() << "NullEnvCell all_env_cell =" << null_env_cell.allEnvCell().null();
111}
112
113/*---------------------------------------------------------------------------*/
114/*---------------------------------------------------------------------------*/
115
116void MeshMaterialTesterModule::
117_testDumpProperties()
118{
119 IMesh* mesh = defaultMesh();
120 VariableCellReal v0(VariableBuildInfo(mesh,"VarTestDump0",IVariable::PNoDump));
121 MaterialVariableCellReal v1(VariableBuildInfo(mesh,"VarTestDump0"));
122 Int32 p0 = v0.variable()->property();
123 Int32 p1 = v1.globalVariable().variable()->property();
124 info() << "PROP1 = " << p0 << " " << p1;
125
126 MaterialVariableCellReal v2(VariableBuildInfo(mesh,"VarTestDump1"));
127 VariableCellReal v3(VariableBuildInfo(mesh,"VarTestDump1",IVariable::PNoDump));
128 Int32 p2 = v2.globalVariable().variable()->property();
129 Int32 p3 = v3.variable()->property();
130 info() << "PROP2 = " << p2 << " " << p3;
131
132 MaterialVariableCellReal v4(VariableBuildInfo(mesh,"VarTestDump2",IVariable::PNoDump));
133 Int32 p4 = v4.globalVariable().variable()->property();
134 info() << "PROP4 = " << p4;
135
136 if (p0!=p1)
137 ARCANE_FATAL("Bad property value p0={0} p1={1}",p0,p1);
138 if (p2!=p3)
139 ARCANE_FATAL("Bad property value p2={0} p3={1}",p2,p3);
140
141 if ((p0 & IVariable::PNoDump)!=0)
142 ARCANE_FATAL("Bad property value p0={0}. Should be Dump",p0);
143 if ((p2 & IVariable::PNoDump)!=0)
144 ARCANE_FATAL("Bad property value p2={0}. Should be Dump",p2);
145}
146
147/*---------------------------------------------------------------------------*/
148/*---------------------------------------------------------------------------*/
153_applyEos(bool is_init)
154{
155 auto* x = options()->additionalEosService();
156 if (!x)
157 return;
158 ENUMERATE_ENV(ienv,m_material_mng){
159 IMeshEnvironment* env = *ienv;
160 ENUMERATE_MAT(imat,env){
161 IMeshMaterial* mat = *imat;
162 info() << "EOS: mat=" << mat->name();
163 ENUMERATE_MATCELL(icell,mat){
164 MatCell mc = *icell;
165 info() << " v=" << mc.globalCell().uniqueId();
166 }
167 if (is_init)
168 x->initEOS(mat,m_mat_pressure,m_mat_density,m_mat_internal_energy,m_mat_sound_speed);
169 else
170 x->applyEOS(mat,m_mat_density,m_mat_internal_energy,m_mat_pressure,m_mat_sound_speed);
171 }
172 }
173}
174
175/*---------------------------------------------------------------------------*/
176/*---------------------------------------------------------------------------*/
177
178void MeshMaterialTesterModule::
179_initUnitTest()
180{
181 IUnitTest* unit_test = options()->additionalTestService();
182 if (unit_test)
183 unit_test->initializeTest();
184}
185
186/*---------------------------------------------------------------------------*/
187/*---------------------------------------------------------------------------*/
188
189void MeshMaterialTesterModule::
190continueInit()
191{
192 info() << "MESH_MATERIAL_TESTER :: continueInit()";
193 _setDependencies();
194 _dumpNoDumpRealValues();
195 _initUnitTest();
196}
197
198/*---------------------------------------------------------------------------*/
199/*---------------------------------------------------------------------------*/
200
201void MeshMaterialTesterModule::
202_setDependencies()
203{
204 info() << "SET_DEPENDENCIES";
205
206 m_mat_density.setMaterialComputeFunction(this,&MeshMaterialTesterModule::_computeMaterialDepend);
207 m_mat_density.addMaterialDepend(m_mat_nodump_real);
208 m_mat_density.addMaterialDepend(m_pressure);
209
210 UniqueArray<VariableDependInfo> infos;
211 UniqueArray<MeshMaterialVariableDependInfo> mat_infos;
212 m_mat_density.materialVariable()->dependInfos(infos,mat_infos);
213
214 for( Integer k=0, n=infos.size(); k<n; ++k )
215 info() << "Global depend v=" << infos[k].variable()->fullName();
216
217 for( Integer k=0, n=mat_infos.size(); k<n; ++k )
218 info() << "Material depend v=" << mat_infos[k].variable()->name();
219}
220
221/*---------------------------------------------------------------------------*/
222/*---------------------------------------------------------------------------*/
232{
233 IMeshComponent* component = mat;
234 if (!component)
235 component = env;
236
237 MaterialVariableCellInt32 test_var(MaterialVariableBuildInfo(m_material_mng,"TestComponentPart"));
238 {
239 Int32 index = 15;
240 ENUMERATE_COMPONENTCELL(iccell,component){
241 test_var[iccell] = index;
242 ++index;
243 }
244 }
245
246 Int32 total_full = 0;
247 Int32 total_pure = 0;
248 Int32 total_impure = 0;
249 ENUMERATE_COMPONENTCELL(iccell,component){
250 MatVarIndex mvi = iccell._varIndex();
251 Int32 v = test_var[iccell];
252 if (mvi.arrayIndex()==0)
253 total_pure += v;
254 else
255 total_impure += v;
256 total_full += v;
257 }
258 info() << "COMPONENT=" << component->name() << " TOTAL PURE=" << total_pure << " IMPURE=" << total_impure
259 << " FULL=" << total_full;
260
261 ValueChecker vc(A_FUNCINFO);
262
263 if (mat){
264 {
265 Int32 total = 0;
267 total += test_var[imc];
268 }
269 vc.areEqual(total,total_full,"TotalFull1");
270 }
271 {
272 Int32 total = 0;
273 using MyMatPartCell = MatPartCell;
274 ENUMERATE_COMPONENTITEM(MyMatPartCell,imc,mat,eMatPart::Impure){
275 total += test_var[imc];
276 }
277 vc.areEqual(total,total_impure,"TotalImpure1");
278 }
279 {
280 Int32 total = 0;
281 ENUMERATE_COMPONENTITEM(MatPartCell,imc,mat,eMatPart::Pure){
282 total += test_var[imc];
283 }
284 vc.areEqual(total,total_pure,"TotalPure1");
285 }
286 {
287 Int32 total = 0;
289 total += test_var[imc];
290 }
291 vc.areEqual(total,total_impure,"TotalImpure2");
292 }
293 {
294 Int32 total = 0;
296 total += test_var[imc];
297 }
298 vc.areEqual(total,total_pure,"TotalPure2");
299 }
300 }
301 if (env){
302 {
303 Int32 total = 0;
304 using MyEnvCell = EnvCell;
305 ENUMERATE_COMPONENTITEM(MyEnvCell,imc,env){
306 total += test_var[imc];
307 }
308 vc.areEqual(total,total_full,"TotalFull1");
309 }
310 {
311 Int32 total = 0;
312 using MyEnvPartCell = EnvPartCell;
313 ENUMERATE_COMPONENTITEM(MyEnvPartCell,imc,env,eMatPart::Impure){
314 total += test_var[imc];
315 }
316 vc.areEqual(total,total_impure,"TotalImpure1");
317 }
318 {
319 Int32 total = 0;
320 ENUMERATE_COMPONENTITEM(EnvPartCell,imc,env,eMatPart::Pure){
321 total += test_var[imc];
322 }
323 vc.areEqual(total,total_pure,"TotalPure1");
324 }
325 {
326 Int32 total = 0;
328 total += test_var[imc];
329 }
330 vc.areEqual(total,total_impure,"TotalImpure2");
331 }
332 {
333 Int32 total = 0;
335 total += test_var[imc];
336 }
337 vc.areEqual(total,total_pure,"TotalPure2");
338 }
339 }
340 {
341 Int32 total = 0;
342 using MyComponentPartCell = ComponentPartCell;
343 ENUMERATE_COMPONENTITEM(MyComponentPartCell,imc,component->impureItems()){
344 total += test_var[imc];
345 }
346 vc.areEqual(total,total_impure,"TotalImpure3");
347 }
348 {
349 Int32 total = 0;
351 total += test_var[imc];
352 }
353 vc.areEqual(total,total_pure,"TotalPure3");
354 }
355}
356
357/*---------------------------------------------------------------------------*/
358/*---------------------------------------------------------------------------*/
359
360void MeshMaterialTesterModule::
361_doDependencies()
362{
363 m_pressure.fill(0.0);
364
365 ENUMERATE_MAT(imat,m_material_mng){
366 IMeshMaterial* mat = *imat;
367 double v = (double)mat->id();
369 m_mat_nodump_real.setUpToDate(mat);
370 m_mat_density.update(mat);
371 }
372
373 // Normalement m_mat_density d'un matériau doit valoir le numéro du matériau
374 ENUMERATE_MAT(imat,m_material_mng){
375 IMeshMaterial* mat = *imat;
376 double v = (double)mat->id();
377 ENUMERATE_MATCELL(imc,mat){
378 if (m_mat_density[imc]!=v)
379 ARCANE_FATAL("Bad value for mat depend v={0} expected={1}",m_mat_density[imc],v);
380 }
381 ENUMERATE_COMPONENTITEM(MatPartCell,imc,mat,eMatPart::Pure){
382 if (m_mat_density[imc]!=v)
383 ARCANE_FATAL("Bad value for mat depend v={0} expected={1}",m_mat_density[imc],v);
384 }
385 }
386
387 // Vérifie que la dépendance sur la variable globale est bien prise en compte
388 m_pressure.fill(1.0);
389 m_pressure.setUpToDate();
390 ENUMERATE_MAT(imat,m_material_mng){
391 IMeshMaterial* mat = *imat;
392 double v0 = (double)mat->id();
393 m_mat_nodump_real.fill(v0);
394 m_mat_density.update(mat);
395 double v = 1.0 + v0;
396 ENUMERATE_MATCELL(imc,mat){
397 if (m_mat_density[imc]!=v)
398 ARCANE_FATAL("Bad value (1) for global depend v={0} expected={1}",m_mat_density[imc],v);
399 }
400 ENUMERATE_COMPONENTITEM(MatPartCell,imc,mat,eMatPart::Impure){
401 if (m_mat_density[imc]!=v)
402 ARCANE_FATAL("Bad value (2) for global depend v={0} expected={1}",m_mat_density[imc],v);
403 }
404 ENUMERATE_COMPONENTITEM(MatPartCell,imc,mat->impureMatItems()){
405 if (m_mat_density[imc]!=v)
406 ARCANE_FATAL("Bad value (2) for global depend v={0} expected={1}",m_mat_density[imc],v);
407 }
408 }
409}
410
411/*---------------------------------------------------------------------------*/
412/*---------------------------------------------------------------------------*/
413
414void MeshMaterialTesterModule::
415_computeMaterialDepend(IMeshMaterial* mat)
416{
417 info() << "Compute material depend mat=" << mat->name();
418 Integer index = 0;
419 ENUMERATE_MATCELL(imc,mat){
420 MatCell mc = *imc;
421 Cell cell = mc.globalCell();
422 m_mat_density[mc] = m_mat_nodump_real[mc] + m_pressure[cell];
423 if (index<5){
424 info() << "Cell=" << ItemPrinter(cell) << " density=" << m_mat_density[mc]
425 << " dump_real=" << m_mat_nodump_real[mc]
426 << " pressure=" << m_pressure[cell];
427 ++index;
428 }
429 }
430 m_mat_density.setUpToDate(mat);
431}
432
433/*---------------------------------------------------------------------------*/
434/*---------------------------------------------------------------------------*/
435
436void MeshMaterialTesterModule::
437_dumpAverageValues()
438{
439 info() << "_dumpAverageValues()";
440 ENUMERATE_ENV(ienv,m_material_mng){
441 IMeshEnvironment* env = *ienv;
442 ENUMERATE_MAT(imat,env){
443 IMeshMaterial* mat = *imat;
444 Real sum_density = 0.0;
445 ENUMERATE_MATCELL(imatcell,mat){
446 //MatCell mc = *icell;
447 sum_density += m_mat_density[imatcell];
448 }
449 info() << "SumMat ITER=" << m_global_iteration() << " MAT=" << mat->name()
450 << " density=" << sum_density;
451 }
452 }
453}
454
455/*---------------------------------------------------------------------------*/
456/*---------------------------------------------------------------------------*/
457
458void MeshMaterialTesterModule::
459_doSimd()
460{
461 info() << "_doSimd()";
462 MaterialVariableCellReal var_tmp(MaterialVariableBuildInfo(m_material_mng,"TestVarTmpReal"));
463 var_tmp.fill(-1.0);
464 // TODO: vérifier les valeurs.
465 ENUMERATE_ENV(ienv,m_material_mng){
466 IMeshEnvironment* env = *ienv;
467 auto out_var_tmp = viewOut(var_tmp);
468 Real value = (Real)(env->id()) * 4.3;
469 ENUMERATE_COMPONENTITEM_LAMBDA(EnvPartSimdCell,ienvcell,env){
470 out_var_tmp[ienvcell] = value;
471 };
472 ENUMERATE_ENVCELL(ienvcell,env){
473 if (var_tmp[ienvcell]!=value)
474 ARCANE_FATAL("Bad value v={0} expected={1}",var_tmp[ienvcell],value);
475 }
476 }
477}
478
479/*---------------------------------------------------------------------------*/
480/*---------------------------------------------------------------------------*/
481
482void MeshMaterialTesterModule::
483_dumpNoDumpRealValues()
484{
485 OStringStream ostr;
486 m_mat_nodump_real.materialVariable()->dumpValues(ostr());
487 info() << ostr.str();
488
489 UniqueArray<IMeshMaterialVariable*> vars;
490 m_material_mng->fillWithUsedVariables(vars);
491 info() << "NB_USED_MATERIAL_VAR=" << vars.size();
492 for( Integer i=0, n=vars.size(); i<n; ++i )
493 info() << "USED_MATERIAL_VAR name=" << vars[i]->name();
494}
495
496/*---------------------------------------------------------------------------*/
497/*---------------------------------------------------------------------------*/
498
499template<typename VectorType> void MeshMaterialTesterModule::
500_checkVectorCopy(VectorType& vec_cells)
501{
502 ValueChecker vc(A_FUNCINFO);
503 // Teste la copie.
504 // Normalement il s'agit d'une copie par référence donc les vues associées
505 // pointent vers la même zone mémoire.
506 VectorType vec_cells_copy(vec_cells);
507 if (!vec_cells_copy.view()._isSamePointerData(vec_cells.view()))
508 ARCANE_FATAL("Bad copy");
509
510 VectorType vec_cells_copy2(vec_cells);
511 vc.areEqual(vec_cells_copy2.view()._matvarIndexes(),vec_cells.view()._matvarIndexes(),"bad copy 2");
512
513 VectorType move_vec_cells(std::move(vec_cells_copy2));
514 vc.areEqual(move_vec_cells.view()._matvarIndexes().data(),vec_cells.view()._matvarIndexes().data(),"bad move 1");
515
516 {
517 // Teste le clone.
518 // A la sortie les valeurs des index doivent être les mêmes mais pas les pointeurs.
519 VectorType clone_vec(vec_cells_copy.clone());
520 vc.areEqual(clone_vec.view()._matvarIndexes(),vec_cells.view()._matvarIndexes(),"bad clone 1");
521 if (clone_vec.view()._constituentItemListView() != vec_cells.view()._constituentItemListView())
522 ARCANE_FATAL("Bad clone 2");
523 if (clone_vec.view()._matvarIndexes().data()==vec_cells.view()._matvarIndexes().data())
524 ARCANE_FATAL("bad clone 3");
525 if (clone_vec.view()._isSamePointerData(vec_cells.view()))
526 ARCANE_FATAL("bad clone 3");
527 }
528}
529
530/*---------------------------------------------------------------------------*/
531/*---------------------------------------------------------------------------*/
532
533void MeshMaterialTesterModule::
534_checkTemporaryVectors(const CellGroup& test_group)
535{
536
537 if (m_mat2){
538 MatCellVector mat_cells(test_group,m_mat1);
539 const MatCellVector& mcref(mat_cells);
540 info() << "SET_DENSITY ON SUB GROUP for material";
541 ENUMERATE_MATCELL(imatcell,m_mat1){
542 MatCell mc = *imatcell;
543 info() << "REF_IDX MAT1 " << mc._varIndex() << " " << mc.globalCell().uniqueId();
544 }
545 ENUMERATE_MATCELL(imatcell,m_mat2){
546 MatCell mc = *imatcell;
547 info() << "REF_IDX MAT2 " << mc._varIndex() << " " << mc.globalCell().uniqueId();
548 }
549 info() << "SET_DENSITY";
550 ENUMERATE_MATCELL(imatcell,mcref){
551 MatCell mc = *imatcell;
552 m_mat_density[mc] = 3.2;
553 info() << "SET_MAT_DENSITY " << mc._varIndex() << " " << mc.globalCell().uniqueId();
554 }
555 _checkVectorCopy(mat_cells);
556 ComponentCellVector component_mat_cells(mat_cells);
557 _checkVectorCopy(component_mat_cells);
558 }
559
560 if (m_mat2){
561 MatCellVector mat_cells(test_group.view(),m_mat1);
562 const MatCellVector& mcref(mat_cells);
563 info() << "SET_DENSITY ON SUB GROUP for material";
564 ENUMERATE_MATCELL(imatcell,m_mat1){
565 MatCell mc = *imatcell;
566 info() << "REF_IDX MAT1 " << mc._varIndex() << " " << mc.globalCell().uniqueId();
567 }
568 ENUMERATE_MATCELL(imatcell,m_mat2->matView()){
569 MatCell mc = *imatcell;
570 info() << "REF_IDX MAT2 " << mc._varIndex() << " " << mc.globalCell().uniqueId();
571 }
572 info() << "SET_DENSITY";
573 ENUMERATE_MATCELL(imatcell,mcref){
574 MatCell mc = *imatcell;
575 m_mat_density[mc] = 3.2;
576 info() << "SET_MAT_DENSITY " << mc._varIndex() << " " << mc.globalCell().uniqueId();
577 }
578 ENUMERATE_MATCELL(imatcell,mat_cells.view()){
579 MatCell mc = *imatcell;
580 m_mat_density[mc] = 3.2;
581 info() << "SET_MAT_DENSITY (VIEW) " << mc._varIndex() << " " << mc.globalCell().uniqueId();
582 }
583 }
584
585 {
586 IMeshEnvironment* env1 = m_mat1->environment();
587 EnvCellVector env_cells(test_group,env1);
588 const EnvCellVector& ecref(env_cells);
589 info() << "SET_DENSITY ON SUB GROUP for environment";
590 ENUMERATE_ENVCELL(ienvcell,env1){
591 EnvCell mc = *ienvcell;
592 info() << "REF_IDX ENV1 " << mc._varIndex() << " uid=" << mc.globalCell().uniqueId();
593 }
594 info() << "SET_DENSITY";
595 ENUMERATE_ENVCELL(ienvcell,ecref){
596 EnvCell mc = *ienvcell;
597 m_mat_density[ienvcell] = 3.2;
598 info() << "SET_ENV_DENSITY " << mc._varIndex() << " uid=" << mc.globalCell().uniqueId();
599 }
600 ENUMERATE_ENVCELL(ienvcell,ecref.view()){
601 EnvCell mc = *ienvcell;
602 m_mat_density[ienvcell] = 3.2;
603 info() << "SET_ENV_DENSITY (VIEW)" << mc._varIndex() << " uid=" << mc.globalCell().uniqueId();
604 }
605 _checkVectorCopy(env_cells);
606 ComponentCellVector component_env_cells(env_cells);
607 _checkVectorCopy(component_env_cells);
608 }
609
610 {
611 IMeshEnvironment* env1 = m_mat1->environment();
612 EnvCellVector env_cells(test_group.view(),env1);
613 const EnvCellVector& ecref(env_cells);
614 info() << "SET_DENSITY ON SUB GROUP for environment";
615 ENUMERATE_ENVCELL(ienvcell,env1){
616 EnvCell mc = *ienvcell;
617 info() << "REF_IDX ENV1 " << mc._varIndex() << " uid=" << mc.globalCell().uniqueId();
618 }
619 info() << "SET_DENSITY";
620 ENUMERATE_ENVCELL(ienvcell,ecref){
621 EnvCell mc = *ienvcell;
622 m_mat_density[ienvcell] = 3.2;
623 info() << "SET_ENV_DENSITY " << mc._varIndex() << " uid=" << mc.globalCell().uniqueId();
624 }
625 }
626}
627
628
629/*---------------------------------------------------------------------------*/
630/*---------------------------------------------------------------------------*/
631
632void MeshMaterialTesterModule::
633_checkEqual(Integer expected_value,Integer value)
634{
635 if (value!=expected_value){
636 ARCANE_FATAL("Bad value v={0} expected={1}",value,expected_value);
637 }
638}
639
640/*---------------------------------------------------------------------------*/
641/*---------------------------------------------------------------------------*/
642
643Integer MeshMaterialTesterModule::
644_fillTestVar(IMeshMaterial* mat,MaterialVariableCellInt64& var)
645{
646 Integer index = 1;
647 Integer total = 0;
648 ENUMERATE_MATCELL(imcell,mat){
649 var[imcell] = index;
650 total += (Integer)var[imcell];
651 ++index;
652 }
653 return total;
654}
655
656/*---------------------------------------------------------------------------*/
657/*---------------------------------------------------------------------------*/
658
659Integer MeshMaterialTesterModule::
661{
662 Integer index = 1;
663 Integer total = 0;
664 ENUMERATE_COMPONENTCELL(iccell,view){
665 var[iccell] = index;
666 total += (Integer)var[iccell];
667 ++index;
668 }
669 return total;
670}
671
672/*---------------------------------------------------------------------------*/
673/*---------------------------------------------------------------------------*/
674
675Integer MeshMaterialTesterModule::
676_checkParallelMatItem(MatItemVectorView mat_view,MaterialVariableCellInt64& var)
677{
678 std::atomic<Integer> new_total;
679 auto func = [&](MatItemVectorView view)
680 {
681 info() << "ParallelLoop with MatItemVectorView size=" << view.nbItem();
682 ENUMERATE_MATCELL(iccell,view){
683 new_total += (Integer)var[iccell];
684 }
685 };
686
687 new_total = 0;
688 Parallel::Foreach(mat_view,func);
689 return (Integer)new_total;
690}
691
692/*---------------------------------------------------------------------------*/
693/*---------------------------------------------------------------------------*/
694
695void MeshMaterialTesterModule::
696_checkSubViews(const CellGroup& test_group)
697{
698 IMeshEnvironment* env1 = m_mat1->environment();
699 EnvCellVector env_cells(test_group.view(),env1);
700 MatCellVector mat_cells(test_group.view(),m_mat1);
701
702 // Vérifie l'utilisation des sous-vues.
703 {
704 ComponentItemVectorView test_group_view(env_cells.view());
705 Integer nb_item = test_group_view.nbItem();
706 for( Integer i=0; i<20; ++i ){
707 Integer begin = i * 9;
708 Integer size = 12;
709 size = math::min(size,nb_item-begin);
710 if (size<=0)
711 break;
712 ComponentItemVectorView v2 = test_group_view._subView(begin,size);
713 ENUMERATE_COMPONENTCELL(iccell,v2){
714 ComponentCell ccell = *iccell;
715 info() << " ComponentCell c=" << ccell._varIndex();
716 }
717 }
718 }
719
720 MaterialVariableCellInt64 mat_test_sub_view(MaterialVariableBuildInfo(m_material_mng,"TestSubViewInt64"));
721 Integer direct_total = 0;
722 Integer direct_mat_total = 0;
723 {
724 Integer index = 1;
725 ENUMERATE_MATCELL(imcell,mat_cells){
726 mat_test_sub_view[imcell] = index;
727 ++index;
728 }
729 index = 1;
730 ENUMERATE_ENVCELL(iecell,env_cells){
731 mat_test_sub_view[iecell] = index;
732 direct_total += index;
733 ++index;
734 }
735 ENUMERATE_MATCELL(imcell,mat_cells){
736 direct_mat_total += (Integer)mat_test_sub_view[imcell];
737 }
738 info() << "DIRECT_ENV_TOTAL = " << direct_total
739 << "DIRECT_MAT_TOTAL = " << direct_mat_total;
740 }
741
742 {
743 ComponentItemVectorView test_group_view(env_cells.view());
744 Integer nb_item = test_group_view.nbItem();
745
746 for( Integer block_size=1; block_size<20; ++block_size){
747 Integer new_total = 0;
748 for( Integer begin=0; begin<nb_item; begin += block_size ){
749 Integer size = block_size;
750 size = math::min(size,nb_item-begin);
751 if (size<=0)
752 break;
753 ComponentItemVectorView v2 = test_group_view._subView(begin,size);
754 ENUMERATE_COMPONENTCELL(iccell,v2){
755 new_total += (Integer)mat_test_sub_view[iccell];
756 }
757 }
758 if (new_total!=direct_total){
759 ARCANE_FATAL("Bad total v={0} expected={1} block_size={2}",
760 new_total,direct_total,block_size);
761 }
762 }
763 }
764
765 // Test en parallèle
766 {
767 ComponentItemVectorView test_group_view(env_cells.view());
768
769 ParallelLoopOptions options;
770 options.setGrainSize(10);
771
772 Integer nb_item = test_group_view.nbItem();
773 info() << "ParallelTest with lambda full_size=" << nb_item;
774
775 // Test avec ComponentItemVectorView
776 {
777 std::atomic<Integer> new_total;
778 new_total = 0;
779 auto func = [&](ComponentItemVectorView view)
780 {
781 info() << "ParallelLoop with component size=" << view.nbItem();
782 ENUMERATE_COMPONENTCELL(iccell,view){
783 new_total += (Integer)mat_test_sub_view[iccell];
784 }
785 };
786 Parallel::Foreach(test_group_view,options,func);
787
788 if (new_total!=direct_total){
789 ARCANE_FATAL("Bad total v={0} expected={1}",(Integer)new_total,direct_total);
790 }
791 }
792
793 // Test avec EnvItemVectorView
794 {
795 EnvItemVectorView env_test_group_view(env_cells.view());
796 std::atomic<Integer> new_total;
797 new_total = 0;
798 auto func = [&](EnvItemVectorView view)
799 {
800 info() << "ParallelLoop with environment size=" << view.nbItem();
801 ENUMERATE_ENVCELL(iccell,view){
802 new_total += (Integer)mat_test_sub_view[iccell];
803 }
804 };
805 Parallel::Foreach(env_test_group_view,options,func);
806
807 if (new_total!=direct_total){
808 ARCANE_FATAL("Bad total v={0} expected={1}",(Integer)new_total,direct_total);
809 }
810 }
811
812 // Test avec MatItemVectorView
813 {
814 MatItemVectorView mat_view(mat_cells.view());
815 Integer ref_val = _fillTestVar(mat_view,mat_test_sub_view);
816 Integer new_val = _checkParallelMatItem(mat_view,mat_test_sub_view);
817 _checkEqual(ref_val,new_val);
818 }
819
820 // Test avec IMeshMaterial
821 {
822 Integer ref_val = _fillTestVar(m_mat1,mat_test_sub_view);
823 Integer new_val = _checkParallelMatItem(m_mat1->matView(),mat_test_sub_view);
824 _checkEqual(ref_val,new_val);
825 }
826
827 // Test avec MatItemVectorView vide
828 {
829 MatCellVector empty_mat_cells(CellGroup(),m_mat1);
830 MatItemVectorView mat_view(empty_mat_cells.view());
831 Integer ref_val = _fillTestVar(mat_view,mat_test_sub_view);
832 Integer new_val = _checkParallelMatItem(mat_view,mat_test_sub_view);
833 _checkEqual(ref_val,new_val);
834 }
835
836 }
837
838 // Test en parallèle avec un pointeur sur membre
839 // (teste uniquement cette belle syntaxe que propose le C++ avec std::bind)
840 {
841 ComponentItemVectorView test_group_view(env_cells.view());
842 Integer nb_item = test_group_view.nbItem();
843 info() << "NB_ITEM=" << nb_item;
844 auto f0 = std::bind(std::mem_fn(&MeshMaterialTesterModule::_subViewFunctor),this,std::placeholders::_1);
845 Parallel::Foreach(test_group_view,ParallelLoopOptions(),f0);
846 // Syntaxe avec lambda
847 Parallel::Foreach(test_group_view,ParallelLoopOptions(),
848 [&](ComponentItemVectorView view){ this->_subViewFunctor(view); }
849 );
850 }
851}
852
853/*---------------------------------------------------------------------------*/
854/*---------------------------------------------------------------------------*/
855
856void MeshMaterialTesterModule::
857_subViewFunctor(ComponentItemVectorView view)
858{
859 ENUMERATE_COMPONENTCELL(iccell,view){
860 }
861}
862
863/*---------------------------------------------------------------------------*/
864/*---------------------------------------------------------------------------*/
865
866void MeshMaterialTesterModule::
867_checkFillArrayFromTo(IMeshMaterial* mat,MaterialVariableCellReal& var)
868{
869 ValueChecker vc(A_FUNCINFO);
870
871 {
872 RealUniqueArray values;
873 Integer nb_cell = mat->cells().size();
874 // Récupère les valeurs de \a var dans \a values puis les mets dans
875 // var_tmp et vérifie que tout est OK.
876 Integer index = 0;
877 values.resize(nb_cell);
878 var.fillToArray(mat,values);
879 ENUMERATE_MATCELL(imatcell,mat){
880 vc.areEqual(var[imatcell],values[index],"Bad value for fillToArray()");
881 ++index;
882 }
883 MaterialVariableCellReal var_tmp(MaterialVariableBuildInfo(m_material_mng,"TestVarTmpReal"));
884
885 index = 0;
886 var_tmp.fillFromArray(mat,values);
887 ENUMERATE_MATCELL(imatcell,mat){
888 vc.areEqual(values[index],var_tmp[imatcell],"Bad value for fillFromArray()");
889 ++index;
890 }
891 }
892
893 {
894 std::map<Int32,MatCell> matvar_indexes;
895 Int32UniqueArray indexes;
896 {
897 Integer wanted_index = 0;
898 Integer iterator_index = 0;
899 ENUMERATE_MATCELL(imatcell,mat){
900 if (iterator_index==wanted_index){
901 matvar_indexes.insert(std::make_pair(iterator_index,*imatcell));
902 indexes.add(iterator_index);
903 }
904 ++iterator_index;
905 }
906 info() << "Indexes=" << indexes;
907 }
908
909 // Idem test précédent mais sur un sous-ensemble des valeurs
910
911 RealUniqueArray values;
912 Integer nb_index = indexes.size();
913 values.resize(nb_index);
914
915 var.fillToArray(mat,values,indexes);
916 for( Integer i=0; i<nb_index; ++i )
917 vc.areEqual(var[matvar_indexes[i]],values[i],"Bad value for fillToArray() (2)");
918
919 MaterialVariableCellReal var_tmp(MaterialVariableBuildInfo(m_material_mng,"TestVarTmpReal2"));
920
921 var_tmp.fillFromArray(mat,values,indexes);
922 for( Integer i=0; i<nb_index; ++i )
923 vc.areEqual(values[i],var_tmp[matvar_indexes[i]],"Bad value for fillFromArray() (2)");
924 }
925}
926
927/*---------------------------------------------------------------------------*/
928/*---------------------------------------------------------------------------*/
929
930template <typename ContainerType> void MeshMaterialTesterModule::
931applyGeneric(const ContainerType& container, MaterialVariableCellReal& var, Real value)
932{
933 ENUMERATE_GENERIC_CELL (igencell, container) {
934 var[igencell] = value;
935 }
936}
937
938/*---------------------------------------------------------------------------*/
939/*---------------------------------------------------------------------------*/
940
941void MeshMaterialTesterModule::
942compute()
943{
944 IUnitTest* unit_test = options()->additionalTestService();
945 if (unit_test)
946 unit_test->executeTest();
947
948 // Si non nul, indique qu'il faut vérifier les valeurs suite à un repartitionnement
949 if (m_check_spectral_values_iteration!=0){
950 info() << "Check spectral values after loadbalancing";
951 _setOrCheckSpectralValues(m_check_spectral_values_iteration,true);
952 m_check_spectral_values_iteration = 0;
953 }
954
955 // Active la variable une itération sur deux pour tester l'activation et désactivation
956 // au cours du temps.
957 m_mat_not_used_real.globalVariable().setUsed((m_global_iteration()%2)==0);
958
959 _dumpAverageValues();
960 _doDependencies();
961 _doSimd();
962 _testComponentPart(m_mat1,nullptr);
963 if (m_mat2)
964 _testComponentPart(m_mat2,nullptr);
965
966 ENUMERATE_ENV(ienv,m_material_mng){
967 _testComponentPart(nullptr,(*ienv));
968 }
969
970 // Teste la création de variable et les accesseurs.
971 using namespace Materials;
972 MaterialVariableCellReal mat_pressure(MaterialVariableBuildInfo(m_material_mng,"Pressure"));
973 mat_pressure.fill(0.0);
974
975 FaceGroup xmin_group = defaultMesh()->faceFamily()->findGroup("XMIN");
976 ENUMERATE_FACE(iface,xmin_group){
977 Face face = *iface;
978 Cell c = face.boundaryCell();
979 Real d = m_density[c];
980 m_density[c] = d + 1.0;
981 }
982
983 {
984 // Teste le constructeur de recopie
985 MaterialVariableCellReal mat_pressure2(mat_pressure);
986 if (mat_pressure2.materialVariable()!=mat_pressure.materialVariable())
987 ARCANE_FATAL("Bad clone");
988 }
989
990 {
991 // Teste le changement de référence.
992 MaterialVariableCellReal mat_test_refersto(MaterialVariableBuildInfo(m_material_mng,"TestRefersToVar"));
993 mat_test_refersto.refersTo(mat_pressure);
994 if (mat_test_refersto.materialVariable()!=mat_pressure.materialVariable())
995 ARCANE_FATAL("Bad refersTo");
996 Real total = 0.0;
997 Real total_ref = 0.0;
998 ENUMERATE_MATCELL(imatcell,m_mat1){
999 total += mat_test_refersto[imatcell];
1000 total_ref += mat_pressure[imatcell];
1001 }
1002 if (total!=total_ref)
1003 ARCANE_FATAL("Bad value for total using refersTo");
1004
1005 }
1006
1007 // Teste le ENUMERATE_GENERIC_CELL
1008 {
1009 MatCellVector mat_cells(ownCells(),m_mat1);
1010 const MatCellVector& mcref(mat_cells);
1011 MaterialVariableCellReal var(MaterialVariableBuildInfo(m_material_mng,"VarTestGeneric"));
1012 applyGeneric(mcref,var,4.5);
1013 ENUMERATE_MATCELL(imatcell,mcref){
1014 if (var[imatcell]!=4.5)
1015 ARCANE_FATAL("Bad value 1 for TestGeneric");
1016 }
1017 applyGeneric(allCells(),var,3.2);
1018 ENUMERATE_CELL(icell,allCells()){
1019 if (var[icell]!=3.2)
1020 ARCANE_FATAL("Bad value 2 for TestGeneric");
1021 }
1022 applyGeneric(m_mat1,var,7.6);
1023 ENUMERATE_MATCELL(imatcell,m_mat1){
1024 if (var[imatcell]!=7.6)
1025 ARCANE_FATAL("Bad value 3 for TestGeneric");
1026 }
1027 applyGeneric(m_mat1->environment(),var,4.2);
1028 ENUMERATE_ENVCELL(imatcell,m_mat1->environment()){
1029 if (var[imatcell]!=4.2)
1030 ARCANE_FATAL("Bad value 4 for TestGeneric");
1031 }
1032 }
1033
1034 // Teste le remplissage des valeurs partielles.
1035 _checkFillPartialValues();
1036
1037 IMeshMaterialVariable* nv = m_material_mng->findVariable(m_pressure.variable()->fullName());
1038 if (!nv)
1039 fatal() << "Can not find MeshVariable (F1)";
1040
1041 IMeshMaterialVariable* nv2 = m_material_mng->findVariable("Pressure");
1042 if (!nv2)
1043 fatal() << "Can not find MeshVariable (F2)";
1044
1045 ENUMERATE_MATCELL(imatcell,m_mat1){
1046 MatCell mmc = *imatcell;
1047 MatVarIndex mvi = mmc._varIndex();
1048 info() << "CELL IN MAT1 i=" << imatcell.index() << " vindex=" << mvi.arrayIndex() << " i=" << mvi.valueIndex();
1049 mat_pressure[mmc] += 0.2;
1050 }
1051
1052 if (m_mat2){
1053 ENUMERATE_MATCELL(imatcell,m_mat2){
1054 MatCell mmc = *imatcell;
1055 MatVarIndex mvi = mmc._varIndex();
1056 info() << "CELL IN MAT2 vindex=" << mvi.arrayIndex() << " i=" << mvi.valueIndex();
1057 //mat_pressure[mmc] -= 0.2;
1058 mat_pressure[imatcell] -= 0.2;
1059 }
1060 }
1061
1062 _checkFillArrayFromTo(m_mat1,mat_pressure);
1063 if (m_mat2)
1064 _checkFillArrayFromTo(m_mat2,mat_pressure);
1065
1066 ENUMERATE_ENV(ienv,m_material_mng){
1067 IMeshEnvironment* env = *ienv;
1068 ENUMERATE_ENVCELL(ienvcell,env){
1069 EnvCell ev = *ienvcell;
1070 MatVarIndex mvi = ev._varIndex();
1071 info() << "CELL IN ENV vindex=" << mvi.arrayIndex() << " i=" << mvi.valueIndex();
1072 mat_pressure[ev] += 3.0;
1073 mat_pressure[ienvcell] += 3.0;
1074 }
1075 ENUMERATE_COMPONENTCELL(icmpcell,env){
1076 ComponentCell cv = *icmpcell;
1077 MatVarIndex mvi = cv._varIndex();
1078 info() << "CELL IN ENV WITH COMPONENT vindex=" << mvi.arrayIndex() << " i=" << mvi.valueIndex();
1079 mat_pressure[cv] += 3.0;
1080 EnvCell env_cell(cv);
1081 if (env_cell._varIndex()!=cv._varIndex())
1082 ARCANE_FATAL("Bad cell");
1083 }
1084 }
1085 _computeDensity();
1086 _checkArrayVariableSynchronize();
1087
1088 for( Integer i=0, n=m_material_mng->materials().size(); i<n; ++i ){
1089 IMeshMaterial* mat = m_material_mng->materials()[i];
1090 m_density_post_processing[i]->copy(m_mat_density.globalVariable());
1091 _copyPartialToGlobal(mat,*m_density_post_processing[i],m_mat_density);
1092 }
1093
1094 // Supprime des mailles pour test
1095 {
1096 info() << "CheckRemove: Cells in MAT1=" << m_mat1->cells().size();
1097 ENUMERATE_MATCELL(imatcell,m_mat1){
1098 MatCell mmc = *imatcell;
1099 MatVarIndex mvi = mmc._varIndex();
1100 info() << "CheckRemove: CELL IN MAT1 i=" << imatcell.index() << " vindex=" << mvi.arrayIndex() << " i=" << mvi.valueIndex()
1101 << " lid=" << mmc.envCell().globalCell();
1102 }
1103
1104 if (m_mat2)
1105 info() << "Cells in MAT2=" << m_mat2->cells().size();
1106
1107 Int32UniqueArray remove_lids;
1108
1109 Int64 last_uid = m_nb_starting_cell() - (m_global_iteration()*30);
1110 info() << "LAST_UID_TO_REMOVE=" << last_uid;
1111
1112 ENUMERATE_CELL(icell,allCells()){
1113 Cell c = *icell;
1114 if (c.uniqueId()>last_uid)
1115 remove_lids.add(c.localId());
1116 }
1117
1118 info() << "Removing cells n=" << remove_lids.size();
1119 mesh()->modifier()->setDynamic(true);
1120 mesh()->modifier()->removeCells(remove_lids);
1121 if (parallelMng()->isParallel()){
1122 // En parallèle, comme on supprime les mailles un peu n'importe comment,
1123 // on supprime les tests tant que le maillage n'est pas à jour.
1124 // TODO: regarder pourquoi le test checkValidMesh() plante.
1125 Integer check_level = mesh()->checkLevel();
1126 mesh()->setCheckLevel(0);
1127 mesh()->modifier()->endUpdate();
1128 {
1129 MeshMaterialIndirectModifier mmim(m_material_mng);
1130 mmim.beginUpdate();
1131 info() << "MESH_MATERIAL_TEST: UpdateGhostLayers";
1132 mesh()->modifier()->updateGhostLayers();
1133 if ((m_global_iteration() % 2)==0){
1134 mmim.endUpdateWithSort();
1135 // TODO: vérifier que tout est trié
1136 }
1137 else
1138 mmim.endUpdate();
1139 }
1140 mesh()->setCheckLevel(check_level);
1141 //mesh()->checkValidMesh();
1142 }
1143 else
1144 mesh()->modifier()->endUpdate();
1145
1146 info() << "End removing cells nb_cell=" << mesh()->nbCell();
1147 }
1148 if (m_mesh_partitioner){
1149 Integer iteration = m_global_iteration();
1150 // Lance un repartitionnement toute les 3 itérations.
1151 if ((iteration%3)==0){
1152 info() << "Registering mesh partition";
1153 subDomain()->timeLoopMng()->registerActionMeshPartition(m_mesh_partitioner);
1154 m_check_spectral_values_iteration = (iteration*2)+1;
1155 _setOrCheckSpectralValues(m_check_spectral_values_iteration,false);
1156 }
1157 }
1158 {
1159 // Initialise la densité et l'energie interne dans les nouvelles mailles.
1160 ENUMERATE_MAT(imat,m_material_mng){
1161 Materials::IMeshMaterial* mat = *imat;
1162 ENUMERATE_MATCELL(icell,mat){
1163 MatCell mc = *icell;
1164 if (m_mat_density[mc] == 0.0)
1165 m_mat_density[mc] = 50.0;
1166 if (m_mat_internal_energy[mc] == 0.0)
1167 m_mat_internal_energy[mc] = 1.0;
1168 }
1169 }
1170 _applyEos(false);
1171 }
1172}
1173
1174/*---------------------------------------------------------------------------*/
1175/*---------------------------------------------------------------------------*/
1176
1177void MeshMaterialTesterModule::
1178_checkFillPartialValues()
1179{
1180 // Teste le remplissage des valeurs partielles par les valeurs globales.
1181 info() << "Check MaterialVariableCellReal";
1182 MaterialVariableCellReal mat_var(MaterialVariableBuildInfo(m_material_mng,"TestFillPartialMat"));
1183 _checkFillPartialValuesHelper(mat_var);
1184
1185 info() << "Check EnvironmentVariableCellReal";
1186 EnvironmentVariableCellReal env_var(MaterialVariableBuildInfo(m_material_mng,"TestFillPartialEnv"));
1187 _checkFillPartialValuesHelper(env_var);
1188 if (m_material_mng->isAllocateScalarEnvironmentVariableAsMaterial()){
1189 MaterialVariableCellReal mat_env_var(MaterialVariableBuildInfo(m_material_mng,"TestFillPartialEnv"));
1190 info() << "Ok for creating Material variable with same name as Environment variable";
1191 }
1192
1193 info() << "Check MaterialVariableCellReal";
1194 MaterialVariableCellArrayReal mat_var2(MaterialVariableBuildInfo(m_material_mng,"TestFillPartialMat2"));
1195 mat_var2.resize(5);
1196 _checkFillPartialValuesHelper(mat_var2);
1197
1198 info() << "Check EnvironmentVariableCellArrayReal";
1199 EnvironmentVariableCellArrayReal env_var2(MaterialVariableBuildInfo(m_material_mng,"TestFillPartialEnv2"));
1200 env_var2.resize(12);
1201 _checkFillPartialValuesHelper(env_var2);
1202}
1203
1204/*---------------------------------------------------------------------------*/
1205/*---------------------------------------------------------------------------*/
1206
1207template<typename VarType> void MeshMaterialTesterModule::
1208_checkFillPartialValuesHelper(VarType& mat_var)
1209{
1210 info() << "Check fillPartialValuesWithGlobalValues()";
1211 _fillVar(mat_var,3.0);
1212 mat_var.materialVariable()->fillPartialValuesWithGlobalValues();
1213 _checkFillPartialValuesWithGlobal(mat_var,m_material_mng->components());
1214
1215 info() << "Check fillPartialValuesWithSuperValues(LEVEL_ALLENVIRONMENT)";
1216 _fillVar(mat_var,7.0);
1217 mat_var.fillPartialValuesWithSuperValues(LEVEL_ALLENVIRONMENT);
1218 _checkFillPartialValuesWithGlobal(mat_var,m_material_mng->components());
1219
1220 info() << "Check fillPartialValuesWithSuperValues(LEVEL_ENVIRONMENT)";
1221 _fillVar(mat_var,-2.0);
1222 mat_var.fillPartialValuesWithSuperValues(LEVEL_ENVIRONMENT);
1223 _checkFillPartialValuesWithSuper(mat_var,m_material_mng->environmentsAsComponents());
1224
1225 info() << "Check fillPartialValuesWithSuperValues(LEVEL_MATERIAl)";
1226 _fillVar(mat_var,-25.0);
1227 mat_var.fillPartialValuesWithSuperValues(LEVEL_MATERIAL);
1228 _checkFillPartialValuesWithSuper(mat_var,m_material_mng->materialsAsComponents());
1229}
1230
1231/*---------------------------------------------------------------------------*/
1232/*---------------------------------------------------------------------------*/
1233
1234namespace
1235{
1236void _setValue(Real& var_ref,Real value)
1237{
1238 var_ref = value;
1239}
1240void _setValue(RealArrayView var_ref,Real value)
1241{
1242 Integer n = var_ref.size();
1243 for( Integer i=0; i<n; ++i ){
1244 var_ref[i] = value*((Real)(i+1));
1245 }
1246}
1247}
1248template<typename VarType> void MeshMaterialTesterModule::
1249_fillVar(VarType& var_type,Real base_value)
1250{
1251 MeshComponentList components = m_material_mng->components();
1252 MatVarSpace var_space = var_type.space();
1253 Int32 index = 0;
1254 ENUMERATE_COMPONENT(ic,components){
1255 IMeshComponent* c = *ic;
1256 if (!c->hasSpace(var_space))
1257 continue;
1258 ENUMERATE_COMPONENTCELL(iccell,c){
1259 ++index;
1260 _setValue(var_type[iccell],(base_value + (Real)index));
1261 }
1262 }
1263}
1264
1265/*---------------------------------------------------------------------------*/
1266/*---------------------------------------------------------------------------*/
1267
1268template<typename VarType> void MeshMaterialTesterModule::
1269_checkFillPartialValuesWithGlobal(const VarType& var_type,MeshComponentList components)
1270{
1271 ValueChecker vc(A_FUNCINFO);
1272 MatVarSpace var_space = var_type.space();
1273
1274 ENUMERATE_COMPONENT(ic,components){
1275 IMeshComponent* c = *ic;
1276 if (!c->hasSpace(var_space))
1277 continue;
1278 ENUMERATE_COMPONENTCELL(iccell,c){
1279 Cell c = (*iccell).globalCell();
1280 auto ref_value = var_type[c];
1281 auto my_value = var_type[iccell];
1282 vc.areEqual(my_value,ref_value,"Bad fill value with global");
1283 }
1284 }
1285}
1286
1287/*---------------------------------------------------------------------------*/
1288/*---------------------------------------------------------------------------*/
1289
1290template<typename VarType> void MeshMaterialTesterModule::
1291_checkFillPartialValuesWithSuper(const VarType& var_type,MeshComponentList components)
1292{
1293 ValueChecker vc(A_FUNCINFO);
1294 MatVarSpace var_space = var_type.space();
1295
1296 ENUMERATE_COMPONENT(ic,components){
1297 IMeshComponent* c = *ic;
1298 if (!c->hasSpace(var_space))
1299 continue;
1300 ENUMERATE_COMPONENTCELL(iccell,c){
1301 ComponentCell c = (*iccell).superCell();
1302 auto ref_value = var_type[c];
1303 auto my_value = var_type[iccell];
1304 vc.areEqual(my_value,ref_value,"Bad fill value with super");
1305 }
1306 }
1307}
1308
1309/*---------------------------------------------------------------------------*/
1310/*---------------------------------------------------------------------------*/
1311
1312template<typename VarType1,typename VarType2,typename VarType3> void MeshMaterialTesterModule::
1313_setOrCheckSpectralValues2(VarType1& var_real,VarType2& var_int32,VarType3& var_scalar_int32,
1314 Int64 iteration,bool is_check)
1315{
1316 typedef std::function<void(Int64,Int64,ComponentItemLocalId)> FunctorType;
1317
1318 Int32 spectral1_dim2 = var_real.globalVariable().arraySize();
1319 Int32 spectral2_dim2 = var_int32.globalVariable().arraySize();
1320 info() << "SET_OR_CHECK size1=" << spectral1_dim2 << " size2=" << spectral2_dim2;
1321 FunctorType set_func = [&](Int64 uid,Int64 iteration,ComponentItemLocalId var_index)
1322 {
1323 Int64 component_idx = var_index.localId().arrayIndex();
1324 Int64 base = uid + iteration + (component_idx+1);
1325 for( Integer i=0; i<spectral1_dim2; ++i )
1326 var_real[var_index][i] = Convert::toReal(2.0 + (Real)(base * spectral1_dim2 + i));
1327 for( Integer i=0; i<spectral2_dim2; ++i )
1328 var_int32[var_index][i] = (Int32)(3 + (base * spectral2_dim2 + i*2 ));
1329 var_scalar_int32[var_index] = (Int32)(3 + (base * spectral2_dim2));
1330 };
1331
1332 ValueChecker vc(A_FUNCINFO);
1333 vc.setThrowOnError(false);
1334
1335 FunctorType check_func = [&](Int64 uid,Int64 iteration,ComponentItemLocalId var_index)
1336 {
1337 Int64 component_idx = var_index.localId().arrayIndex();
1338 Int64 base = uid + iteration + (component_idx+1);
1339 for( Integer i=0; i<spectral1_dim2; ++i ){
1340 Real ref1 = Convert::toReal(2.0 + (Real)(base * spectral1_dim2 + i));
1341 //info() << "CHECK1 var=" << var_real.name() << " idx=" << var_index << " v1=" << ref1 << " v2=" << var_real[var_index][i];
1342 vc.areEqual(ref1,var_real[var_index][i],String::format("spectral1:{0}",var_real.name()));
1343 }
1344 for( Integer i=0; i<spectral2_dim2; ++i ){
1345 Int32 ref2 = (Int32)(3 + (base * spectral2_dim2 + i*2 ));
1346 //info() << "CHECK2 var=" << var_real.name() << " idx=" << var_index << " v1=" << ref2 << " v2=" << var_int32[var_index][i];
1347 vc.areEqual(ref2,var_int32[var_index][i],String::format("spectral2:{0}",var_int32.name()));
1348 }
1349 Int32 ref3 = (Int32)(3 + (base * spectral2_dim2));
1350 vc.areEqual(ref3,var_scalar_int32[var_index],"scalar1");
1351 if (vc.nbError()!=0){
1352 error() << "Error for cell uid=" << uid << " var_index=" << var_index;
1353 vc.throwIfError();
1354 }
1355 };
1356
1357 FunctorType func = (is_check) ? check_func : set_func;
1358
1359 bool has_mat = var_real.materialVariable()->space()!=MatVarSpace::Environment;
1360 ENUMERATE_ALLENVCELL(iallenvcell,m_material_mng,allCells()){
1361 AllEnvCell all_env_cell = *iallenvcell;
1362 Cell global_cell = all_env_cell.globalCell();
1363 Int64 cell_uid = global_cell.uniqueId();
1364 ENUMERATE_CELL_ENVCELL(ienvcell,all_env_cell){
1365 func(cell_uid,iteration,ienvcell);
1366 if (has_mat){
1367 ENUMERATE_CELL_MATCELL(imatcell,(*ienvcell)){
1368 func(cell_uid,iteration,imatcell);
1369 }
1370 }
1371 }
1372 func(cell_uid,iteration,all_env_cell);
1373 }
1374}
1375
1376/*---------------------------------------------------------------------------*/
1377/*---------------------------------------------------------------------------*/
1378
1379void MeshMaterialTesterModule::
1380_setOrCheckSpectralValues(Int64 iteration,bool is_check)
1381{
1382 _setOrCheckSpectralValues2(m_mat_spectral1,m_mat_spectral2,m_mat_int32,iteration,is_check);
1383 _setOrCheckSpectralValues2(m_env_spectral1,m_env_spectral2,m_env_int32,iteration,is_check);
1384}
1385
1386/*---------------------------------------------------------------------------*/
1387/*---------------------------------------------------------------------------*/
1388
1389void MeshMaterialTesterModule::
1390_checkArrayVariableSynchronize()
1391{
1392 info() << "_checkArrayVariableSynchronize(): SYNCHRONIZE_MATERIALS";
1393 m_material_mng->synchronizeMaterialsInCells();
1394 m_material_mng->checkMaterialsInCells();
1395
1396 Int64 iteration = m_global_iteration();
1397
1398 _setOrCheckSpectralValues(iteration,false);
1399
1400 // On utilise la synchro par liste une itération sur deux.
1401 if ((iteration % 2)==0){
1402 MeshMaterialVariableSynchronizerList mlist(m_material_mng);
1403 m_mat_spectral1.synchronize(mlist);
1404 m_mat_spectral2.synchronize(mlist);
1405 m_env_spectral1.synchronize(mlist);
1406 m_env_spectral2.synchronize(mlist);
1407 m_mat_int32.synchronize();
1408 m_env_int32.synchronize();
1409 mlist.apply();
1410 }
1411 else{
1412 m_mat_spectral1.synchronize();
1413 m_mat_spectral2.synchronize();
1414 m_env_spectral1.synchronize();
1415 m_env_spectral2.synchronize();
1416 m_mat_int32.synchronize();
1417 m_env_int32.synchronize();
1418 }
1419
1420 _setOrCheckSpectralValues(iteration,true);
1421}
1422
1423/*---------------------------------------------------------------------------*/
1424/*---------------------------------------------------------------------------*/
1425
1426void MeshMaterialTesterModule::
1427_computeDensity()
1428{
1429 VariableCellReal tmp_cell_mat_density(VariableBuildInfo(defaultMesh(),"TmpCellMatDensity"));
1430 VariableNodeReal tmp_node_mat_density(VariableBuildInfo(defaultMesh(),"TmpNodeMatDensity"));
1431
1432 Int32UniqueArray mat_to_add_array;
1433 Int32UniqueArray mat_to_remove_array;
1434 // Calcul les mailles dans lesquelles il faut ajouter ou supprimer des matériaux
1435 {
1436 Materials::MeshMaterialModifier modifier(m_material_mng);
1437 ENUMERATE_ENV(ienv,m_material_mng){
1438 IMeshEnvironment* env = *ienv;
1439 ENUMERATE_MAT(imat,env){
1440 IMeshMaterial* mat = *imat;
1441 mat_to_add_array.clear();
1442 mat_to_remove_array.clear();
1443 _fillDensity(*imat,tmp_cell_mat_density,tmp_node_mat_density,mat_to_add_array,mat_to_remove_array,true);
1444 info() << "FILL_DENSITY_INFO ITER=" << m_global_iteration()
1445 << " mat=" << mat->name()
1446 << " nb_to_add=" << mat_to_add_array.size()
1447 << " nb_to_remove=" << mat_to_remove_array.size();
1448
1449 modifier.removeCells(mat,mat_to_remove_array);
1450 modifier.addCells(mat,mat_to_add_array);
1451 }
1452 }
1453 }
1454
1455 // Met à jour les valeurs.
1456 {
1457 ENUMERATE_ENV(ienv,m_material_mng){
1458 IMeshEnvironment* env = *ienv;
1459 ENUMERATE_MAT(imat,env){
1460 _fillDensity(*imat,tmp_cell_mat_density,tmp_node_mat_density,mat_to_add_array,mat_to_remove_array,false);
1461 }
1462 }
1463 }
1464 // Pour que les synchronisations fonctionnent bien,
1465 // il faut que les matériaux soient les mêmes dans toutes les mailles.
1466 m_material_mng->synchronizeMaterialsInCells();
1467 info() << "Synchronize density";
1468 m_mat_density.synchronize();
1469}
1470
1471/*---------------------------------------------------------------------------*/
1472/*---------------------------------------------------------------------------*/
1473
1474void MeshMaterialTesterModule::
1475_copyPartialToGlobal(IMeshMaterial* mat,VariableCellReal& global_density,
1476 MaterialVariableCellReal& partial_variable)
1477{
1478 ENUMERATE_MATCELL(imatcell,mat){
1479 MatCell mc = *imatcell;
1480 Cell global_cell = mc.globalCell();
1481 global_density[global_cell] = partial_variable[mc];
1482 }
1483}
1484
1485/*---------------------------------------------------------------------------*/
1486/*---------------------------------------------------------------------------*/
1501_fillDensity(IMeshMaterial* mat,VariableCellReal& tmp_cell_mat_density,
1502 VariableNodeReal& tmp_node_mat_density,
1503 Int32Array& mat_to_add_array,Int32Array& mat_to_remove_array,
1504 bool is_compute_mat)
1505{
1506 Int32 mat_id = mat->id();
1507 tmp_cell_mat_density.fill(0.0);
1508 tmp_node_mat_density.fill(0.0);
1509 info() << "FILL MAT=" << mat->name();
1510
1511 // Copy dans tmp_cell_mat_density la valeur partielle de la densité pour \a mat
1512 _copyPartialToGlobal(mat,tmp_cell_mat_density,m_mat_density);
1513
1514 // La valeur aux noeuds est la moyenne de la valeur aux mailles autour
1515 ENUMERATE_NODE(inode,allNodes()){
1516 Real v = 0.0;
1517 for( CellLocalId icell : inode->cellIds() )
1518 v += tmp_cell_mat_density[icell];
1519 v /= (Real)inode->nbCell();
1520 v *= 0.8;
1521 tmp_node_mat_density[inode] = v;
1522 }
1523
1524 // Phase1, calcule les mailles où le matériau sera créé ou supprimé.
1525 // Cela se fait en fonction de certaines valeurs (arbitraires) de la densité.
1526 if (is_compute_mat){
1527 ENUMERATE_CELL(icell,allCells()){
1528 Cell cell = *icell;
1529 Real current_density = tmp_cell_mat_density[icell];
1530 Real new_density = 0.0;
1531 bool has_material = (m_present_material[cell] & (1<<mat_id));
1532 for( NodeLocalId inode : cell.nodeIds() )
1533 new_density += tmp_node_mat_density[inode];
1534 new_density /= (Real)cell.nbNode();
1535 if (new_density>=0.5 && !has_material && current_density==0.0){
1536 mat_to_add_array.add(cell.localId());
1537 info() << "NEW CELL FOR MAT " << mat_id << " uid=" << ItemPrinter(cell) << " new=" << new_density;
1538 }
1539 else if (new_density<0.4 && has_material && current_density>0.4){
1540 mat_to_remove_array.add(cell.localId());
1541 info() << "REMOVE CELL FOR MAT " << mat_id << " uid=" << ItemPrinter(cell) << " new=" << new_density
1542 << " old=" << current_density;
1543 }
1544 tmp_cell_mat_density[icell] = new_density;
1545 }
1546 }
1547 else{
1548 // Phase2: met à jour les valeurs maintenant que le matériau a été
1549 // ajouté dans toutes les mailles
1550
1551 ENUMERATE_CELL(icell,allCells()){
1552 Cell cell = *icell;
1553 Real new_density = 0.0;
1554 for( NodeLocalId inode : cell.nodeIds() )
1555 new_density += tmp_node_mat_density[inode];
1556 new_density /= (Real)cell.nbNode();
1557 tmp_cell_mat_density[icell] = new_density;
1558 }
1559
1560 ENUMERATE_MATCELL(imatcell,mat){
1561 MatCell mc = *imatcell;
1562 Cell global_cell = mc.globalCell();
1563 //Real density = tmp_cell_mat_density[global_cell];
1564 //info() << "ASSIGN cell=" << global_cell.uniqueId() << " density=" << density;
1565 m_mat_density[mc] = tmp_cell_mat_density[global_cell];
1566 }
1567 }
1568 {
1569 StdMeshVariables<MeshMaterialVariableTraits> xm(meshHandle(),"Base1","Base2");
1570 }
1571}
1572
1573/*---------------------------------------------------------------------------*/
1574/*---------------------------------------------------------------------------*/
1575
1576void MeshMaterialTesterModule::
1577_checkCreation2(Integer a,Integer n)
1578{
1579 Int64 z = 0;
1580 info() << "I=" << a << " N=" << n;
1581 for( Integer i=0; i<n; ++i ){
1582 MaterialVariableCellReal mat_pressure(MaterialVariableBuildInfo(m_material_mng,"Pressure"));
1583 z += mat_pressure.materialVariable()->name().length();
1584 }
1585 info() << "Z=" << z;
1586}
1587
1588/*---------------------------------------------------------------------------*/
1589/*---------------------------------------------------------------------------*/
1595{
1596 Integer n = 0;
1597 ParallelLoopOptions options;
1598 options.setGrainSize(20);
1599 arcaneParallelFor(0,1000,options,[&](Integer a,Integer n) { _checkCreation2(a,n); });
1600
1601 info() << "CHECK CREATE N=" << n;
1602
1603 {
1604 MaterialVariableCellReal mat_pressure(MaterialVariableBuildInfo(m_material_mng,"Pressure"));
1605 mat_pressure.fill(0.0);
1606 ENUMERATE_MATCELL(imatcell,m_mat1){
1607 MatCell mmc = *imatcell;
1608 mat_pressure[mmc] += 0.2;
1609 }
1610 }
1611}
1612
1613/*---------------------------------------------------------------------------*/
1614/*---------------------------------------------------------------------------*/
1615
1616} // End namespace ArcaneTest
1617
1618/*---------------------------------------------------------------------------*/
1619/*---------------------------------------------------------------------------*/
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
#define ENUMERATE_COMPONENTITEM_LAMBDA(iter_type, iter, container)
Macro pour itérer sur les entités d'un composant via une fonction lambda du C++11.
Classes, Types et macros pour gérer la concurrence.
#define ENUMERATE_FACE(name, group)
Enumérateur générique d'un groupe de faces.
#define ENUMERATE_CELL(name, group)
Enumérateur générique d'un groupe de mailles.
#define ENUMERATE_NODE(name, group)
Enumérateur générique d'un groupe de noeuds.
void _applyEos(bool is_init)
Appelle le service d'EOS s'il est disponible.
MaterialVariableCellReal m_mat_nodump_real
Variable pour tester la bonne prise en compte du PNoDump.
void _checkCreation()
Test la création à la volée des variables, avec multi-threading.
MaterialVariableCellReal m_mat_not_used_real
Variable pour tester la bonne prise en compte de setUsed(false)
void _fillDensity(IMeshMaterial *mat, VariableCellReal &tmp_cell_mat_density, VariableNodeReal &tmp_node_mat_density, Int32Array &mat_to_add_array, Int32Array &mat_to_remove_array, bool is_compute_mat)
void _testComponentPart(IMeshMaterial *mat, IMeshEnvironment *env)
Teste les itérateurs par partie.
IMeshPartitioner * m_mesh_partitioner
Partitioner en cas d'équilibrage. Est géré par une option du JDD.
Integer size() const
Nombre d'éléments du vecteur.
void add(ConstReferenceType val)
Ajoute l'élément val à la fin du tableau.
Maille d'un maillage.
Definition Item.h:1205
Interface d'un service de test unitaire.
Definition IUnitTest.h:34
virtual void initializeTest()=0
Méthode appelée après lecture du jeu de données pour initialiser le test.
virtual void executeTest()=0
Méthode appelée pour exécuter le test.
@ PNoDump
Indique que la variable ne doit pas être sauvegardée.
Definition IVariable.h:74
Classe utilitaire pour imprimer les infos sur une entité.
Definition ItemPrinter.h:35
Int32 nbNode() const
Nombre de noeuds de l'entité
Definition Item.h:785
NodeLocalIdView nodeIds() const
Liste des noeuds de l'entité
Definition Item.h:794
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
Definition Item.h:219
ItemUniqueId uniqueId() const
Identifiant unique sur tous les domaines.
Definition Item.h:225
void fill(const DataType &value)
Remplit les valeurs partielles et globales de la variable avec la valeur value.
Vue sur un vecteur sur les entités d'un composant.
Cell globalCell() const
Maille globale.
__host__ __device__ ComponentCell superCell() const
Maille de niveau supérieur dans la hiérarchie.
__host__ __device__ MatVarIndex _varIndex() const
Maille arcane d'un milieu.
Interface d'un composant (matériau ou milieu) d'un maillage.
virtual String name() const =0
Nom du composant.
virtual Int32 id() const =0
Identifiant du composant.
virtual ComponentImpurePartItemVectorView impureItems() const =0
Vue sur la liste des entités impures (partielles) partielles du composant.
virtual ComponentPurePartItemVectorView pureItems() const =0
Vue sur la liste des entités pures (associées à la maille globale) du composant.
virtual EnvImpurePartItemVectorView impureEnvItems() const =0
Vue sur la liste des entités impures (partielles) partielles du milieu.
virtual EnvPurePartItemVectorView pureEnvItems() const =0
Vue sur la liste des entités pures (associées à la maille globale) du milieu.
Interface d'un matériau d'un maillage.
virtual MatImpurePartItemVectorView impureMatItems() const =0
Vue sur la liste des entités impures (partielles) partielles du matériau.
virtual MatPurePartItemVectorView pureMatItems() const =0
Vue sur la liste des entités pures (associées à la maille globale) du matériau.
Représente un matériau d'une maille multi-matériau.
Vue sur un vecteur sur les entités d'un matériau.
Représente un index sur les variables matériaux et milieux.
constexpr __host__ __device__ Int32 arrayIndex() const
Retourne l'indice du tableau de valeur dans la liste des variables.
Options d'exécution d'une boucle parallèle en multi-thread.
void setGrainSize(Integer v)
Positionne la taille (approximative) d'un intervalle d'itération.
Vérification de la validité de certaines valeurs.
void areEqual(const T1 &value, const T2 &expected_value, const String &message)
#define ENUMERATE_ENV(ienv, container)
Macro pour itérer sur une liste de milieux.
#define ENUMERATE_ENVCELL(iname, env)
Macro pour itérer sur toutes les mailles d'un milieu.
#define ENUMERATE_COMPONENTITEM(enumerator_class_name, iname,...)
Macro générique pour itérer sur les entités d'un matériau ou d'un milieu.
#define ENUMERATE_CELL_MATCELL(iname, env_cell)
Macro pour itérer sur tous les matériaux d'une maille.
#define ENUMERATE_COMPONENT(icomponent, container)
Macro pour itérer sur une liste de composants.
#define ENUMERATE_GENERIC_CELL(iname, mat_or_env_or_group)
Macro pour itérer de manière générique sur les matériaux, milieux ou les mailles.
#define ENUMERATE_CELL_ENVCELL(iname, all_env_cell)
Macro pour itérer sur tous les milieux d'une maille.
#define ENUMERATE_MATCELL(iname, mat)
Macro pour itérer sur toutes les mailles d'un matériau.
#define ENUMERATE_ALLENVCELL(iname,...)
Macro pour itérer sur toutes les mailles AllEnvCell d'un groupe.
#define ENUMERATE_COMPONENTCELL(iname, component)
Macro pour itérer sur toutes les mailles d'un composant.
#define ENUMERATE_MAT(imat, container)
Macro pour itérer sur une liste de matériaux.
void arcaneParallelFor(Integer i0, Integer size, InstanceType *itype, void(InstanceType::*lambda_function)(Integer i0, Integer size))
Applique en concurrence la fonction lambda lambda_function sur l'intervalle d'itération [i0,...
__host__ __device__ Real2 min(Real2 a, Real2 b)
Retourne le minimum de deux Real2.
Definition MathUtils.h:336
ItemGroupT< Cell > CellGroup
Groupe de mailles.
Definition ItemTypes.h:183
ItemGroupT< Face > FaceGroup
Groupe de faces.
Definition ItemTypes.h:178
MeshVariableScalarRefT< Cell, Real > VariableCellReal
Grandeur au centre des mailles de type réel.
MeshVariableScalarRefT< Node, Real > VariableNodeReal
Grandeur au noeud de type réel.
auto viewOut(const ViewBuildInfo &vbi, CellMaterialVariableScalarRef< DataType > &var)
Vue en écriture pour les variables materiaux scalaire.
eExecutionPolicy
Politique d'exécution pour un Runner.
Real toReal(Real r)
Converti r en un Real.
Definition Convert.h:80
ComponentItemVector ComponentCellVector
Liste de ComponentCell issues d'un IMeshComponent.
ConstArrayView< IMeshComponent * > MeshComponentList
Liste de composants multi-matériaux du maillage.
CellEnvironmentVariableArrayRef< Real > EnvironmentVariableCellArrayReal
Variable milieu de type tableau de Real
CellMaterialVariableScalarRef< Int64 > MaterialVariableCellInt64
Variable matériau de type Int64
CellEnvironmentVariableScalarRef< Real > EnvironmentVariableCellReal
Variable milieu de type Real
CellMaterialVariableScalarRef< Real > MaterialVariableCellReal
Variable matériau de type Real
MatVarSpace
Espace de définition d'une variable matériau.
CellMaterialVariableScalarRef< Int32 > MaterialVariableCellInt32
Variable matériau de type Int32
CellMaterialVariableArrayRef< Real > MaterialVariableCellArrayReal
Variable matériau de type tableau de Real
void Foreach(const ItemVectorView &items_view, const ParallelLoopOptions &options, InstanceType *instance, void(InstanceType::*function)(ItemVectorViewT< ItemType > items))
std::int64_t Int64
Type entier signé sur 64 bits.
Int32 Integer
Type représentant un entier.
UniqueArray< Int32 > Int32UniqueArray
Tableau dynamique à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:428
UniqueArray< Real > RealUniqueArray
Tableau dynamique à une dimension de réels.
Definition UtilsTypes.h:436
double Real
Type représentant un réel.
Array< Int32 > Int32Array
Tableau dynamique à une dimension d'entiers 32 bits.
Definition UtilsTypes.h:214
ArrayView< Real > RealArrayView
Equivalent C d'un tableau à une dimension de réels.
Definition UtilsTypes.h:546
@ Cell
Le maillage est AMR par maille.
Definition MeshKind.h:52
std::int32_t Int32
Type entier signé sur 32 bits.