gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
gmshRegion.cpp
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 #include <stdlib.h>
7 #include "GModel.h"
8 #include "gmshRegion.h"
9 #include "Geo.h"
10 #include "GmshMessage.h"
11 
13 {
14  resetNativePtr(v);
16 }
17 
19 {
20  _v = v;
21  l_faces.clear();
22  l_dirs.clear();
23  for(int i = 0; i < List_Nbr(_v->Surfaces); i++) {
24  Surface *s;
25  List_Read(_v->Surfaces, i, &s);
26  int ori;
28  GFace *f = model()->getFaceByTag(abs(s->Num));
29  if(f) {
30  l_faces.push_back(f);
31  l_dirs.push_back(ori);
32  f->addRegion(this);
33  }
34  else
35  Msg::Error("Unknown surface %d", s->Num);
36  }
37  for(int i = 0; i < List_Nbr(_v->SurfacesByTag); i++) {
38  int is;
39  List_Read(_v->SurfacesByTag, i, &is);
40  GFace *f = model()->getFaceByTag(abs(is));
41  if(f) {
42  l_faces.push_back(f);
43  l_dirs.push_back(gmsh_sign(is));
44  f->addRegion(this);
45  }
46  else
47  Msg::Error("Unknown surface %d", is);
48  }
49 }
50 
52 {
53  meshAttributes.recombine3D = _v->Recombine3D;
54  meshAttributes.method = _v->Method;
55  meshAttributes.QuadTri = _v->QuadTri;
56  meshAttributes.extrude = _v->Extrude;
57  if(meshAttributes.method == MESH_TRANSFINITE) {
58  meshAttributes.corners.clear();
59  for(int i = 0; i < List_Nbr(_v->TrsfPoints); i++) {
60  Vertex *corn;
61  List_Read(_v->TrsfPoints, i, &corn);
62  GVertex *gv = model()->getVertexByTag(corn->Num);
63  if(gv)
64  meshAttributes.corners.push_back(gv);
65  else
66  Msg::Error("Unknown point %d in transfinite attributes", corn->Num);
67  }
68  }
69 }
70 
72 {
73  switch(_v->Typ) {
75  default: return Volume;
76  }
77 }
Volume
Definition: Geo.h:140
Surface::Num
int Num
Definition: Geo.h:113
Geo.h
GRegion::l_faces
std::vector< GFace * > l_faces
Definition: GRegion.h:30
Volume::QuadTri
int QuadTri
Definition: Geo.h:146
gmsh_sign
int gmsh_sign(T const &value)
Definition: Numeric.h:28
gmshRegion::geomType
virtual GeomType geomType() const
Definition: gmshRegion.cpp:71
gmshRegion::_v
::Volume * _v
Definition: gmshRegion.h:15
GFace
Definition: GFace.h:33
GEntity::model
GModel * model() const
Definition: GEntity.h:277
MESH_TRANSFINITE
#define MESH_TRANSFINITE
Definition: GmshDefines.h:259
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
LegendrePolynomials::f
void f(int n, double u, double *val)
Definition: orthogonalBasis.cpp:77
List_Nbr
int List_Nbr(List_T *liste)
Definition: ListUtils.cpp:106
GModel::getFaceByTag
GFace * getFaceByTag(int n) const
Definition: GModel.cpp:326
Vertex
Definition: Geo.h:29
GmshMessage.h
gmshRegion::resetNativePtr
void resetNativePtr(::Volume *v)
Definition: gmshRegion.cpp:18
MSH_VOLUME_DISCRETE
#define MSH_VOLUME_DISCRETE
Definition: GeoDefines.h:41
Volume::Surfaces
List_T * Surfaces
Definition: Geo.h:149
Vertex::Num
int Num
Definition: Geo.h:31
Volume::Extrude
ExtrudeParams * Extrude
Definition: Geo.h:147
Volume::Typ
int Typ
Definition: Geo.h:143
Volume::Method
int Method
Definition: Geo.h:144
GVertex
Definition: GVertex.h:23
GEntity::DiscreteVolume
@ DiscreteVolume
Definition: GEntity.h:120
GModel
Definition: GModel.h:44
gmshRegion::gmshRegion
gmshRegion(GModel *m, ::Volume *v)
Definition: gmshRegion.cpp:12
Surface
Definition: Geo.h:111
GRegion::l_dirs
std::vector< int > l_dirs
Definition: GRegion.h:34
Volume::SurfacesOrientations
List_T * SurfacesOrientations
Definition: Geo.h:150
gmshRegion::resetMeshAttributes
virtual void resetMeshAttributes()
Definition: gmshRegion.cpp:51
GRegion
Definition: GRegion.h:28
GEntity::GeomType
GeomType
Definition: GEntity.h:88
gmshRegion.h
Volume::SurfacesByTag
List_T * SurfacesByTag
Definition: Geo.h:151
GRegion::meshAttributes
struct GRegion::@20 meshAttributes
GEntity::Volume
@ Volume
Definition: GEntity.h:119
Volume::TrsfPoints
List_T * TrsfPoints
Definition: Geo.h:148
GModel.h
Volume::Recombine3D
int Recombine3D
Definition: Geo.h:145
GModel::getVertexByTag
GVertex * getVertexByTag(int n) const
Definition: GModel.cpp:346
List_Read
void List_Read(List_T *liste, int index, void *data)
Definition: ListUtils.cpp:111