7#include "GeometryServiceBase.h"
12#include <arcane/IMesh.h>
15#include <arcane/IItemOperationByBasicType.h>
16#include <arcane/IItemFamily.h>
17#include <arcane/ArcaneVersion.h>
18#include <arcane/ItemVectorView.h>
23NUMERICS_BEGIN_NAMESPACE
47 properties.defined |= property;
51 properties.storages[
static_cast<IGeometryProperty::eProperty
>(
current_property)].storageType |= storage;
53 << IGeometryProperty::name(
static_cast<IGeometryProperty::eProperty
>(
current_property))
54 <<
"] on group " << group.
name();
64 ARCANE_ASSERT((IGeometryProperty::isScalar(property)), (
"Scalar property expected"));
67 if (storage.realVar) {
68 if (storage.realVar->name() !=
var.name())
69 traceMng()->
fatal() <<
"Geometric property [" << IGeometryProperty::name(property)
70 <<
"] storage already defined on group " << group.
name()
71 <<
" with variable " << storage.realVar->name();
72 ARCANE_ASSERT((properties.defined & property), (
"Unconsistent state with undefined property with defined variable"));
75 properties.defined |= property;
77 storage.storageType |= IGeometryProperty::PVariable;
78 storage.externStorage |= IGeometryProperty::PVariable;
89 ARCANE_ASSERT((IGeometryProperty::isVectorial(property)), (
"Vectorial property expected"));
92 if (storage.real3Var) {
93 if (storage.real3Var->name() !=
var.name())
94 traceMng()->
fatal() <<
"Geometric property [" << IGeometryProperty::name(property)
95 <<
"] storage already defined on group " << group.
name()
96 <<
" with variable " << storage.real3Var->name();
97 ARCANE_ASSERT((properties.defined & property), (
"Unconsistent state with undefined property with defined variable"));
100 properties.defined |= property;
102 storage.storageType |= IGeometryProperty::PVariable;
103 storage.externStorage |= IGeometryProperty::PVariable;
115 PropertyMap::const_iterator
iprop = m_group_property_map.find(group.
internal());
116 if (
iprop == m_group_property_map.end())
117 return IGeometryProperty::PNone;
118 return iprop->second.defined;
131 PropertyMap::const_iterator
iprop = m_group_property_map.find(group.
internal());
132 if (
iprop == m_group_property_map.end())
133 return IGeometryProperty::PNoStorage;
134 return iprop->second.getStorage(property);
143 if (!IGeometryProperty::isScalar(property))
144 traceMng()->
fatal() <<
"Non scalar property requested by scalar interface";
146 std::shared_ptr<RealVariable>&
pvar = storage.realVar;
149 storage.usageVarCount++;
157 if (!IGeometryProperty::isVectorial(property))
158 traceMng()->
fatal() <<
"Non vectorial property requested by vectorial interface";
160 std::shared_ptr<Real3Variable>&
pvar = storage.real3Var;
163 storage.usageVarCount++;
190 _checkItemGroupUsage();
191 _resetComputeFlags();
203 if (m_group_property_map.find(
allItemGroup.internal()) != m_group_property_map.end()) {
208 for (PropertyMap::iterator
igroup = m_group_property_map.begin();
igroup != m_group_property_map.end(); ++
igroup) {
212 for (ItemGroupGeometryProperty::StorageInfos::const_iterator
iprop =
group_property.storages.begin();
214 const IGeometryProperty::eProperty
property =
iprop->first;
220 if (IGeometryProperty::isScalar(property)) {
221#ifndef NO_USER_WARNING
222#warning "failed when ItemGroupMap storage only on allItems group"
227 if (storage.storageType & IGeometryProperty::PVariable) {
228 if (storage.externStorage & IGeometryProperty::PVariable) {
235 std::shared_ptr<RealVariable>&
lvar = storage.realVar;
237 if (
lvar->variable() !=
var.variable()) {
255 ARCANE_ASSERT((IGeometryProperty::isVectorial(property)), (
"Vectorial property expected"));
259 if (storage.storageType & IGeometryProperty::PVariable) {
260 if (storage.externStorage & IGeometryProperty::PVariable) {
267 std::shared_ptr<Real3Variable>&
lvar = storage.real3Var;
269 if (
lvar->variable() !=
var.variable()) {
294 for (PropertyMap::iterator
iprop = m_group_property_map.begin();
iprop != m_group_property_map.end(); ++
iprop) {
302 for (PropertyMap::iterator
iprop = m_group_property_map.begin();
iprop != m_group_property_map.end(); ++
iprop) {
312 IGeometryProperty::eProperty property,
313 IGeometryProperty::eStorage storage)
315 PropertyMap::iterator
iprop = m_group_property_map.find(group);
316 if (
iprop == m_group_property_map.end())
319 if ((properties.defined & property) != property)
320 ARCANE_FATAL(
"Non available property [{0}] requested from group {1}",
321 IGeometryProperty::name(property), group->
name());
323 if ((storages.storageType & storage) != storage)
324 ARCANE_FATAL(
"Non available storage [{0}] requested for property {1} on group {2}",
325 IGeometryProperty::name(storage), IGeometryProperty::name(property), group->
name());
332void GeometryServiceBase::_resetComputeFlags()
334 for (PropertyMap::iterator
igroup = m_group_property_map.begin();
igroup != m_group_property_map.end(); ++
igroup) {
343void GeometryServiceBase::_checkItemGroupUsage()
346 typedef std::map<const IVariable*, std::pair<ItemGroupImpl*, IGeometryProperty::eProperty>>
ExternVariables;
349 for (PropertyMap::iterator
igroup = m_group_property_map.begin();
igroup != m_group_property_map.end(); ++
igroup) {
351 for (ItemGroupGeometryProperty::StorageInfos::const_iterator i =
group_property.storages.begin();
353 const IGeometryProperty::eProperty
property = i->first;
355 if (info.usageVarCount == 0 && (info.realVar || info.real3Var) && !(info.externStorage & IGeometryProperty::PVariable))
356 traceMng()->
warning() <<
"Geometric property " << IGeometryProperty::name(property)
357 <<
" on group " <<
igroup->first->name() <<
" with Variable storage never used since last update";
360 if (info.realVar || (info.real3Var && (info.externStorage & IGeometryProperty::PVariable))) {
371 traceMng()->
warning() <<
"Geometric property " << IGeometryProperty::name(property)
372 <<
" on group " <<
igroup->first->name()
373 <<
" shares extern Variable " <<
finder->first->name()
374 <<
" with property " << IGeometryProperty::name(
finder->second.second)
375 <<
" on group " <<
finder->second.first->name();
388NUMERICS_END_NAMESPACE
#define ARCANE_FATAL(...)
Macro envoyant une exception FatalErrorException.
void addItemGroupProperty(ItemGroup group, Integer property, Integer storage=IGeometryProperty::PVariable)
Set geometric properties on a ItemGroup.
void update()
Update property values for all ItemGroups.
Integer getItemGroupPropertyStorage(ItemGroup group, IGeometryProperty::eProperty property)
Check if a storage is available on an ItemGroup.
Integer getItemGroupProperty(ItemGroup group)
Get set of properties of an ItemGroup.
virtual IMesh * mesh()=0
Access to mesh.
ItemGroupGeometryProperty::StorageInfo & _checkItemGroupProperty(ItemGroupImpl *group, IGeometryProperty::eProperty property, IGeometryProperty::eStorage storage)
Return ItemGroupGeometryProperty if requested property and storage are available.
const Real3Variable & getReal3VariableProperty(ItemGroup group, IGeometryProperty::eProperty property)
Get geometric property values for a Real3 field.
const RealVariable & getRealVariableProperty(ItemGroup group, IGeometryProperty::eProperty property)
Get geometric property values for a Real field.
String m_suffix
suffix for internal variable names
void reset()
Reset property for all ItemGroups.
virtual ~GeometryServiceBase()
virtual const char * className() const =0
Name of instancied class.
virtual ITraceMng * traceMng()=0
Access to traceMng.
bool hasItemGroupProperty(ItemGroup group, Integer property)
Check is a property is activated on an ItemGroup.
Interface d'une famille d'entités.
virtual ItemGroup allItems() const =0
Groupe de toutes les entités.
Interface d'une variable.
Internal class implementation for TemisGeometryService and Euclidian3GeometryService.
Implémentation d'un groupe d'entités de maillage.
const String & name() const
Nom du groupe.
Groupe d'entités de maillage.
ItemGroupImpl * internal() const
Retourne l'implémentation du groupe.
const String & name() const
Nom du groupe.
eItemKind itemKind() const
Genre du groupe. Il s'agit du genre de ses éléments.
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Exception lorsqu'une erreur fatale est survenue.
Chaîne de caractères unicode.
TraceMessageDbg debug(Trace::eDebugLevel=Trace::Medium) const
Flot pour un message de debug.
TraceMessage warning() const
Flot pour un message d'avertissement.
TraceMessage fatal() const
Flot pour un message d'erreur fatale.
Positionne une classe de message.
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
eItemKind
Genre d'entité de maillage.
@ IK_Cell
Entité de maillage de genre maille.
@ IK_Face
Entité de maillage de genre face.
Int32 Integer
Type représentant un entier.