1
1
// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2
2
// -----------------------------------------------------------------------------
3
- // Copyright 2000-2023 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
3
+ // Copyright 2000-2024 CEA (www.cea.fr) IFPEN (www.ifpenergiesnouvelles.com)
4
4
// See the top-level COPYRIGHT file for details.
5
5
// SPDX-License-Identifier: Apache-2.0
6
6
// -----------------------------------------------------------------------------
7
7
/* ---------------------------------------------------------------------------*/
8
- /* MaterialHeatTestModule.cc (C) 2000-2023 */
8
+ /* MaterialHeatTestModule.cc (C) 2000-2024 */
9
9
/* */
10
10
/* Module de test des matériaux. */
11
11
/* ---------------------------------------------------------------------------*/
29
29
#include " arcane/materials/MeshMaterialModifier.h"
30
30
#include " arcane/materials/ComponentItemVectorView.h"
31
31
32
+ #include " arcane/accelerator/core/IAcceleratorMng.h"
33
+ #include " arcane/accelerator/core/RunCommand.h"
34
+ #include " arcane/accelerator/core/RunQueue.h"
35
+ #include " arcane/accelerator/VariableViews.h"
36
+ #include " arcane/accelerator/MaterialVariableViews.h"
37
+ #include " arcane/accelerator/RunCommandMaterialEnumerate.h"
38
+
32
39
#include " arcane/tests/ArcaneTestGlobal.h"
33
40
#include " arcane/tests/MaterialHeatTest_axl.h"
34
41
@@ -49,7 +56,7 @@ using namespace Arcane::Materials;
49
56
class MaterialHeatTestModule
50
57
: public ArcaneMaterialHeatTestObject
51
58
{
52
- private :
59
+ public :
53
60
54
61
// ! Caractéristiques de l'objet qui chauffe (disque ou sphère)
55
62
struct HeatObject
@@ -120,7 +127,9 @@ class MaterialHeatTestModule
120
127
void _computeGlobalTemperature ();
121
128
void _computeCellsToAdd (const HeatObject& heat_object, MaterialWorkArray& wa);
122
129
void _computeCellsToRemove (const HeatObject& heat_object, MaterialWorkArray& wa);
130
+ public:
123
131
void _addHeat (const HeatObject& heat_object);
132
+ private:
124
133
void _addCold (const HeatObject& heat_object);
125
134
void _initNewCells (const HeatObject& heat_object, MaterialWorkArray& wa);
126
135
void _compute ();
@@ -157,9 +166,11 @@ MaterialHeatTestModule::
157
166
void MaterialHeatTestModule::
158
167
buildInit ()
159
168
{
169
+ ProfilingRegistry::setProfilingLevel (2 );
170
+
160
171
// La création des milieux et des matériaux doit se faire dans un point
161
172
// d'entrée de type 'build' pour que la liste des variables créés par les
162
- // milieux et les matériaux soit accessible dans le post-traitement.
173
+ // milieux et les matériaux soit accessibles dans le post-traitement.
163
174
info () << " MaterialHeatTestModule::buildInit()" ;
164
175
165
176
Materials::IMeshMaterialMng* mm = IMeshMaterialMng::getReference (defaultMesh ());
@@ -378,18 +389,23 @@ _addHeat(const HeatObject& heat_object)
378
389
const Real heat_radius_norm = heat_object.radius * heat_object.radius ;
379
390
380
391
IMeshMaterial* current_mat = heat_object.material ;
392
+ RunQueue* queue = this ->acceleratorMng ()->defaultQueue ();
393
+ auto command = makeCommand (queue);
394
+
395
+ auto in_cell_center = viewIn (command, m_cell_center);
396
+ auto inout_mat_temperature = viewInOut (command, m_mat_temperature);
381
397
382
398
// ! Chauffe les mailles déjà présentes dans le matériau
383
- ENUMERATE_MATCELL (imatcell, current_mat) {
384
- MatCell mc = *imatcell;
385
- Cell cell = mc. globalCell ();
386
- Real3 center = m_cell_center [cell];
399
+ command << RUNCOMMAND_MAT_ENUMERATE (MatAndGlobalCell, iter, current_mat)
400
+ {
401
+ auto [matcell, cell] = iter ();
402
+ Real3 center = in_cell_center [cell];
387
403
Real distance2 = (center - heat_center).squareNormL2 ();
388
404
if (distance2 < heat_radius_norm) {
389
405
Real to_add = heat_value / (1.0 + distance2);
390
- m_mat_temperature[mc ] += to_add;
406
+ inout_mat_temperature[matcell ] += to_add;
391
407
}
392
- }
408
+ };
393
409
}
394
410
395
411
/* ---------------------------------------------------------------------------*/
0 commit comments