Arcane  4.1.12.0
Developer documentation
Loading...
Searching...
No Matches
CellFamilyPolicyMng.cc
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/* CellFamilyPolicyMng.cc (C) 2000-2018 */
9/* */
10/* Cell family policy manager. */
11/*---------------------------------------------------------------------------*/
12/*---------------------------------------------------------------------------*/
13
14#include "arcane/core/IItemFamilyNetwork.h"
15
16#include "arcane/mesh/ItemFamilyPolicyMng.h"
17#include "arcane/mesh/ItemFamilyCompactPolicy.h"
18#include "arcane/mesh/CellFamilySerializer.h"
19#include "arcane/mesh/CellFamily.h"
20#include "arcane/mesh/DynamicMesh.h"
21#include "arcane/mesh/ItemFamilySerializer.h"
22
23/*---------------------------------------------------------------------------*/
24/*---------------------------------------------------------------------------*/
25
26namespace Arcane::mesh
27{
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
35class ARCANE_MESH_EXPORT CellFamilyPolicyMng
36: public ItemFamilyPolicyMng
37{
38 public:
39
40 CellFamilyPolicyMng(CellFamily* family)
41 : ItemFamilyPolicyMng(family, new StandardItemFamilyCompactPolicy(family))
42 , m_family(family)
43 {}
44
45 public:
46
47 IItemFamilySerializer* createSerializer(bool use_flags) override
48 {
49 IMesh* mesh = m_family->mesh();
50 DynamicMesh* dmesh = ARCANE_CHECK_POINTER(dynamic_cast<DynamicMesh*>(mesh));
51 // Todo use unique_ptr ?
52 if (mesh->useMeshItemFamilyDependencies())
53 return new ItemFamilySerializer(m_family, m_family, dmesh->incrementalBuilder());
54 else
55 return new CellFamilySerializer(m_family, use_flags, dmesh->incrementalBuilder());
56 }
57
58 private:
59
60 CellFamily* m_family;
61};
62
63/*---------------------------------------------------------------------------*/
64/*---------------------------------------------------------------------------*/
65
66extern "C++" ARCANE_MESH_EXPORT IItemFamilyPolicyMng*
67createCellFamilyPolicyMng(ItemFamily* family)
68{
69 CellFamily* f = ARCANE_CHECK_POINTER(dynamic_cast<CellFamily*>(family));
70 return new CellFamilyPolicyMng(f);
71}
72
73/*---------------------------------------------------------------------------*/
74/*---------------------------------------------------------------------------*/
75
76} // namespace Arcane::mesh
77
78/*---------------------------------------------------------------------------*/
79/*---------------------------------------------------------------------------*/
#define ARCANE_CHECK_POINTER(ptr)
Macro returning the pointer ptr if it is not null or throwing an exception if it is null.
Interface for entity family policies.
Manages the serialization/deserialization of entities in a family.
IItemFamilySerializer * createSerializer(bool use_flags) override
Creates an instance for entity serialization. The returned instance must be destroyed by the delete o...
Serialization/Deserialization of cell families.
Implementation of a mesh.
Definition DynamicMesh.h:98
Serialization/Deserialization of item families.
Compaction policy for Node, Edge, Face, or Cell entity families.