Arcane  v3.14.10.0
Documentation développeur
Chargement...
Recherche...
Aucune correspondance
GeometryKernelSurfaceInternalUtils.h
1// -*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
2//-----------------------------------------------------------------------------
3// Copyright 2000-2022 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#ifndef ARCGEOSIM_SURFACEUTILS_GEOMETRYKERNELSURFACETOOLS_GEOMETRYKERNELSURFACEINTERNALUTILS_H
8#define ARCGEOSIM_SURFACEUTILS_GEOMETRYKERNELSURFACETOOLS_GEOMETRYKERNELSURFACEINTERNALUTILS_H
9/* Author : havep at Wed Apr 1 14:31:35 2009
10 * Generated by createNew
11 */
12
13#include <arcane/Item.h>
14#include <arcane/utils/Array.h>
15#include <arcane/utils/Real3.h>
16#include "arcane/VariableTypes.h"
17#include <arcane/ItemGroup.h>
18#include <arcane/IMeshSubMeshTransition.h>
19
20#include <GeometryKernel/datamodel/micro/surface/triangulation-data-structure.h>
21#include <GeometryKernel/datamodel/geometry/vector.h>
22
23#include <map>
24
25ARCANE_BEGIN_NAMESPACE
26NUMERICS_BEGIN_NAMESPACE
27using namespace Arcane;
28
29/*---------------------------------------------------------------------------*/
30/*---------------------------------------------------------------------------*/
31
34 GeometryKernel::TriangulationDataStructurePtr m_triangulation,
35 Array<Node> & m_node_array,
36 Array<Face> & m_face_array,
37 Array<bool> & m_face_reorient,
38 Real3 & m_mean_normal);
40void saveSurface(const char * filename, GeometryKernel::TriangulationDataStructure & tr);
42void loadSurface(const char * filename, GeometryKernel::TriangulationDataStructure & tr);
44inline Real3 convertGKVector(const GeometryKernel::Vector & v) { return Real3(v.getX(),v.getY(),v.getZ()); }
45inline GeometryKernel::Vector convertGKVector(const Real3 & v) { return GeometryKernel::Vector(v.x,v.y,v.z); }
46
47/*---------------------------------------------------------------------------*/
48/*---------------------------------------------------------------------------*/
49
51public:
52 NodeMapping(IMesh * mesh,
54 GeometryKernel::TriangulationDataStructure & triangulation)
55 : m_nodes_coordinates(PRIMARYMESH_CAST(mesh)->nodesCoordinates()),
56 m_node_array(node_array),
57 m_triangulation(triangulation)
58 {
59 ;
60 }
61
62 GeometryKernel::TObjectId getNodeId(const Node node)
63 {
64 const Integer inode = node.localId();
65 std::pair<KnownNodes::iterator,bool> inserter = m_known_nodes.insert(KnownNodes::value_type(inode,NULL_ID));
66 if (inserter.second)
67 { // New value
68 const Real3 coords = m_nodes_coordinates[node];
69 const GeometryKernel::TObjectId new_id = m_triangulation.newVertex(GeometryKernel::Vector(coords.x,coords.y,coords.z));
70 ARCANE_ASSERT(((Integer)m_node_array.size()==(Integer)new_id),("Non-synchronized GeometryKernel with internal SurfaceImpl [%d vs %d]",new_id,m_node_array.size()));
71 m_node_array.add(node);
72 return (inserter.first->second = new_id);
73 }
74 else
75 { // Already existing value
76 return inserter.first->second;
77 }
78 }
79
80 Real3 computeNormal(const Node node1, const Node node2, const Node node3) {
81 const Real3 node1_coord = m_nodes_coordinates[node1];
82 const Real3 node2_coord = m_nodes_coordinates[node2];
83 const Real3 node3_coord = m_nodes_coordinates[node3];
85 }
86
87private:
88 const VariableNodeReal3 & m_nodes_coordinates;
89 Array<Node> & m_node_array;
90 GeometryKernel::TriangulationDataStructure & m_triangulation;
91
92 typedef std::map<Integer,GeometryKernel::TObjectId> KnownNodes;
93 KnownNodes m_known_nodes;
94};
95
96/*---------------------------------------------------------------------------*/
97
98NUMERICS_END_NAMESPACE
99ARCANE_END_NAMESPACE
100
101#endif /* ARCGEOSIM_SURFACEUTILS_GEOMETRYKERNELSURFACETOOLS_GEOMETRYKERNELSURFACEINTERNALUTILS_H */
constexpr Int32 localId() const
Identifiant local de l'entité dans le sous-domaine du processeur.
Definition Item.h:210
Lecteur des fichiers de maillage via la bibliothèque LIMA.
Definition Lima.cc:120
Noeud d'un maillage.
Definition Dom.h:204
Classe gérant un vecteur de réel de dimension 3.
Definition Real3.h:132
-*- tab-width: 2; indent-tabs-mode: nil; coding: utf-8-with-signature -*-
Real3 convertGKVector(const GeometryKernel::Vector &v)
convert GeometryKernel vector to Real3
void loadSurface(const char *filename, GeometryKernel::TriangulationDataStructure &tr)
Load surface utility for debugging purpose (binary format)
void saveSurface(const char *filename, GeometryKernel::TriangulationDataStructure &tr)
Save surface utility for debugging purpose (binary format)
void buildFaceGroupSurface(FaceGroup group, GeometryKernel::TriangulationDataStructurePtr surface, Array< Node > &node_array, Array< Face > &face_array, Array< bool > &face_reorient, Real3 &normal)
Build GK triangulation and additional data from a face group.
Real y
deuxième composante du triplet
Definition Real3.h:36
Real z
troisième composante du triplet
Definition Real3.h:37
Real x
première composante du triplet
Definition Real3.h:35