Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
GeometryServiceBaseT.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2026 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#include "arcane/geometry/impl/GeometryTemplatesT.h"
9#include "arcane/core/VariableBuildInfo.h"
10
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14namespace Arcane::Numerics
15{
16
17/*---------------------------------------------------------------------------*/
18/*---------------------------------------------------------------------------*/
19
20template <typename GeometryT>
21void GeometryServiceBase::
22updateGroup(ItemGroup group, GeometryT& geometry)
23{
24 PropertyMap::iterator igroup = m_group_property_map.find(group.internal());
25 if (igroup == m_group_property_map.end())
26 throw FatalErrorException(A_FUNCINFO, "Undefined ItemGroup property");
27
28 ItemGroupGeometryProperty& properties = igroup->second;
29 if ((properties.defined & ~properties.computed & ~properties.delegated) == 0) {
30 traceMng()->debug() << "Group " << group.name() << " properties already done";
31 return;
32 }
33
34 for (typename ItemGroupGeometryProperty::StorageInfos::iterator i = properties.storages.begin(); i != properties.storages.end(); ++i) {
35 IGeometryProperty::eProperty property = i->first;
36 ItemGroupGeometryProperty::StorageInfo& storage = i->second;
37
38 if ((properties.computed & property) || (properties.delegated & property)) {
39 traceMng()->debug() << "Property " << IGeometryProperty::name(property) << " is delayed for group " << group.name();
40 continue; // skip that property
41 }
42 else {
43 traceMng()->debug() << "Property " << IGeometryProperty::name(property) << " will be computed for group " << group.name();
44 }
45
46 if (IGeometryProperty::isScalar(property)) {
47 std::shared_ptr<RealVariable>& ivar = storage.realVar;
48 if (!ivar && (storage.storageType & IGeometryProperty::PVariable)) {
49 String varName = IGeometryProperty::name(property) + String("Of") + group.name() + m_suffix;
50 traceMng()->debug() << "Building Variable " << varName;
51 ivar.reset(new RealVariable(VariableBuildInfo(group.mesh(),
52 varName,
53 group.itemFamily()->name(),
55 group.itemKind()));
56 }
57 }
58 else {
59 ARCANE_ASSERT((IGeometryProperty::isVectorial(property)), ("Vectorial property expected"));
60 std::shared_ptr<Real3Variable>& ivar = storage.real3Var;
61 if (!ivar && (storage.storageType & IGeometryProperty::PVariable)) {
62 String varName = IGeometryProperty::name(property) + String("Of") + group.name() + m_suffix;
63 traceMng()->debug() << "Building Variable " << varName;
64 ivar.reset(new Real3Variable(VariableBuildInfo(group.mesh(),
65 varName,
66 group.itemFamily()->name(),
68 group.itemKind()));
69 }
70 }
71 }
72
73 if (properties.defined & ~properties.computed & ~properties.delegated) {
74 GenericGSInternalUpdater<GeometryT> updater(geometry, traceMng());
75 updater.setGroupProperty(&properties);
76 group.applyOperation(&updater);
77 }
78
79 /*** The general assignment is now handled in GeometryTemplatesT ***/
80 for (typename ItemGroupGeometryProperty::StorageInfos::iterator i = properties.storages.begin(); i != properties.storages.end(); ++i) {
81 IGeometryProperty::eProperty property = i->first;
82 if ((properties.computed & property) || (properties.delegated & property))
83 continue;
84 properties.computed |= property;
85 }
86}
87
88/*---------------------------------------------------------------------------*/
89/*---------------------------------------------------------------------------*/
90
91} // namespace Arcane::Numerics
92
93/*---------------------------------------------------------------------------*/
94/*---------------------------------------------------------------------------*/
virtual String name() const =0
Family name.
virtual TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium)=0
Stream for a debug message.
@ PTemporary
Indicates that the variable is temporary.
Definition IVariable.h:114
@ PPrivate
Indicates that the variable is private.
Definition IVariable.h:103
Mesh entity group.
Definition ItemGroup.h:51
ItemGroupImpl * internal() const
Returns the group implementation.
Definition ItemGroup.h:125
const String & name() const
Group name.
Definition ItemGroup.h:81
IItemFamily * itemFamily() const
Entity family to which this group belongs (0 for the null group).
Definition ItemGroup.h:128
void applyOperation(IItemOperationByBasicType *operation) const
Applies the operation operation to the entities of the group.
Definition ItemGroup.cc:528
eItemKind itemKind() const
Group kind. This is the kind of its elements.
Definition ItemGroup.h:114
IMesh * mesh() const
Mesh to which this group belongs (0 for the null group).
Definition ItemGroup.h:131
String m_suffix
suffix for internal variable names
virtual ITraceMng * traceMng()=0
Access to traceMng.
virtual IGeometry * geometry()=0
Get underlying geometry.