gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
MeshSizeFieldView.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 "MeshSizeFieldView.h"
7 #include "GmshConfig.h"
8 #include "GModel.h"
9 
10 #if defined(HAVE_MESH)
11 #include "Field.h"
12 #endif
13 
15  {GMSH_FULLRC, "MeshSizeField", nullptr, 0.},
16  {GMSH_FULLRC, "View", nullptr, -1.},
17  {GMSH_FULLRC, "Component", nullptr, 0.}};
18 
19 extern "C" {
21 {
22  return new GMSH_MeshSizeFieldViewPlugin();
23 }
24 }
25 
27 {
28  return "Plugin(MeshSizeFieldView) evaluates the mesh size field "
29  "`MeshSizeField' "
30  "on specified `Component` (0 for scalar) of the post-processing view "
31  "`View'.";
32 }
33 
35 {
36  return sizeof(MeshSizeFieldViewOptions_Number) / sizeof(StringXNumber);
37 }
38 
40 {
41  return &MeshSizeFieldViewOptions_Number[iopt];
42 }
43 
45 {
46 #if defined(HAVE_MESH)
47  int field = (int)MeshSizeFieldViewOptions_Number[0].def;
48  int iView = (int)MeshSizeFieldViewOptions_Number[1].def;
49  int comp = (int)MeshSizeFieldViewOptions_Number[2].def;
50 
51  PView *v1 = getView(iView, view);
52  if(!v1) return view;
53  Field *f = GModel::current()->getFields()->get(field);
54  if(f)
55  f->putOnView(v1, comp);
56  else
57  Msg::Error("Unknown mesh size field %d", field);
58  return v1;
59 #else
60  Msg::Error("Plugin(MeshSizeFieldView) requires the mesh module");
61  return view;
62 #endif
63 }
PView
Definition: PView.h:27
Field.h
GMSH_MeshSizeFieldViewPlugin::execute
PView * execute(PView *)
Definition: MeshSizeFieldView.cpp:44
GMSH_Plugin
Definition: Plugin.h:26
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
StringXNumber
Definition: Options.h:918
MeshSizeFieldView.h
MeshSizeFieldViewOptions_Number
StringXNumber MeshSizeFieldViewOptions_Number[]
Definition: MeshSizeFieldView.cpp:14
GMSH_MeshSizeFieldViewPlugin::getOption
StringXNumber * getOption(int iopt)
Definition: MeshSizeFieldView.cpp:39
GMSH_RegisterMeshSizeFieldViewPlugin
GMSH_Plugin * GMSH_RegisterMeshSizeFieldViewPlugin()
Definition: MeshSizeFieldView.cpp:20
GMSH_FULLRC
#define GMSH_FULLRC
Definition: Options.h:20
FieldManager::get
Field * get(int id)
Definition: Field.cpp:74
GMSH_MeshSizeFieldViewPlugin
Definition: MeshSizeFieldView.h:15
GModel::getFields
FieldManager * getFields()
Definition: GModel.h:325
Field
Definition: Field.h:103
GMSH_PostPlugin::getView
virtual PView * getView(int index, PView *view)
Definition: Plugin.cpp:81
GMSH_MeshSizeFieldViewPlugin::getNbOptions
int getNbOptions() const
Definition: MeshSizeFieldView.cpp:34
GMSH_MeshSizeFieldViewPlugin::getHelp
std::string getHelp() const
Definition: MeshSizeFieldView.cpp:26
GModel.h
GModel::current
static GModel * current(int index=-1)
Definition: GModel.cpp:136