gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
CGNSZoneStruct.h
Go to the documentation of this file.
1 // Gmsh - Copyright (C) 1997-2022 C. Geuzaine, J.-F. Remacle
2 //
3 // See the LICENSE.txt file in the Gmsh root directory for license information.
4 // Please report all issues on https://gitlab.onelab.info/gmsh/gmsh/issues.
5 //
6 // Contributor(s):
7 // Thomas Toulorge
8 
9 #ifndef CGNS_ZONE_STRUCT_H
10 #define CGNS_ZONE_STRUCT_H
11 
12 #include "CGNSZone.h"
13 
14 #if defined(HAVE_LIBCGNS)
15 
16 template <int DIM> class CGNSZoneStruct : public CGNSZone {
17 public:
18  CGNSZoneStruct(int fileIndex, int baseIndex, int zoneIndex, int meshDim,
19  cgsize_t startNode,
20  const Family2EltNodeTransfo &allEltNodeTransfo, int &err);
21 
22  cgsize_t nbNodeIJK(int d) const { return size_[d]; }
23  cgsize_t nbEltIJK(int d) const { return size_[DIM + d]; }
24  const cgsize_t *nbNodeIJK() const { return size_; }
25  const cgsize_t *nbEltIJK() const { return size_ + DIM; }
26  cgsize_t nbNodeInRange(const cgsize_t *range) const;
27  cgsize_t nbEltInRange(const cgsize_t *range) const;
28 
29  virtual cgsize_t indexDataSize(cgsize_t nbVal) { return DIM * nbVal; }
30 
31  virtual void eltFromRange(const cgsize_t *range,
32  std::vector<cgsize_t> &elt) const;
33  virtual void eltFromList(const std::vector<cgsize_t> &list,
34  std::vector<cgsize_t> &elt) const;
35  virtual void nodeFromRange(const cgsize_t *range,
36  std::vector<cgsize_t> &node) const;
37  virtual void nodeFromList(const std::vector<cgsize_t> &range,
38  std::vector<cgsize_t> &node) const;
39 
40  virtual int readElements(std::vector<MVertex *> &allVert,
41  std::map<int, std::vector<MElement *> > *allElt,
42  std::vector<MElement *> &zoneElt,
43  std::vector<std::string> &allGeomName);
44 
45  virtual int readConnectivities(const std::map<std::string, int> &name2Zone,
46  std::vector<CGNSZone *> &allZones);
47 
48 protected:
49  int readOneInterface(int iConnect,
50  const std::map<std::string, int> &name2Zone,
51  std::vector<CGNSZone *> &allZones);
52  MElement *makeBndElement(const cgsize_t *ijk, const int *dir, int order,
53  int defaultEntity, std::vector<MVertex *> &allVert,
54  std::map<int, std::vector<MElement *> > *allElt);
55 };
56 
57 template <int DIM>
58 inline cgsize_t CGNSZoneStruct<DIM>::nbNodeInRange(const cgsize_t *range) const
59 {
60  return StructuredIndexing<DIM>::nbEntInRange(range);
61 }
62 
63 template <int DIM>
64 inline cgsize_t CGNSZoneStruct<DIM>::nbEltInRange(const cgsize_t *range) const
65 {
66  return StructuredIndexing<DIM>::nbEntInRange(range);
67 }
68 
69 template <int DIM>
70 inline void CGNSZoneStruct<DIM>::eltFromRange(const cgsize_t *range,
71  std::vector<cgsize_t> &elt) const
72 {
73  StructuredIndexing<DIM>::entFromRange(range, nbEltIJK(), elt);
74 }
75 
76 template <int DIM>
77 inline void CGNSZoneStruct<DIM>::eltFromList(const std::vector<cgsize_t> &list,
78  std::vector<cgsize_t> &elt) const
79 {
80  StructuredIndexing<DIM>::entFromList(list, nbEltIJK(), elt);
81 }
82 
83 template <int DIM>
84 inline void
85 CGNSZoneStruct<DIM>::nodeFromRange(const cgsize_t *range,
86  std::vector<cgsize_t> &node) const
87 {
88  StructuredIndexing<DIM>::entFromRange(range, nbNodeIJK(), node);
89 }
90 
91 template <int DIM>
92 inline void CGNSZoneStruct<DIM>::nodeFromList(const std::vector<cgsize_t> &list,
93  std::vector<cgsize_t> &node) const
94 {
95  StructuredIndexing<DIM>::entFromList(list, nbNodeIJK(), node);
96 }
97 
98 #endif // HAVE_LIBCGNS
99 
100 #endif // CGNS_ZONE_STRUCT_H
CGNSZone.h
MElement
Definition: MElement.h:30