gmsh-TingyuanDoc  0.1
An Open-Source Timing-driven Analytical Mixed-size FPGA Placer
PViewDataRemote.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 #ifndef PVIEW_DATA_REMOTE_H
7 #define PVIEW_DATA_REMOTE_H
8 
9 #include <vector>
10 #include <string>
11 #include "GmshMessage.h"
12 #include "PViewData.h"
13 #include "SBoundingBox3d.h"
14 #include "onelab.h"
15 
16 // The container for a remote dataset (does not contain any actual data)
17 class PViewDataRemote : public PViewData {
18 private:
20  double _min, _max;
22  double _time;
24 
25 public:
26  PViewDataRemote(onelab::localNetworkClient *remote, double min, double max,
27  int numsteps, double time, SBoundingBox3d &bbox)
28  : _remote(remote), _min(min), _max(max), _numTimeSteps(numsteps),
29  _time(time), _bbox(bbox)
30  {
31  }
33  bool finalize(bool computeMinMax = true,
34  const std::string &interpolationScheme = "")
35  {
36  return true;
37  }
38  int getNumTimeSteps() { return _numTimeSteps; }
39  double getMin(int step = -1, bool onlyVisible = false, int tensorRep = 0,
40  int forceNumComponents = 0, int componentMap[9] = nullptr)
41  {
42  return _min;
43  }
44  double getMax(int step = -1, bool onlyVisible = false, int tensorRep = 0,
45  int forceNumComponents = 0, int componentMap[9] = nullptr)
46  {
47  return _max;
48  }
49  SBoundingBox3d getBoundingBox(int step = -1) { return _bbox; }
50  double getTime(int step) { return _time; }
51  // need to return != 0 for "empty" tests
52  int getNumElements(int step = -1, int ent = -1) { return -1; }
53  void setMin(double min) { _min = min; }
54  void setMax(double max) { _max = max; }
55  void setBoundingBox(SBoundingBox3d &bbox) { _bbox = bbox; }
56  void setTime(double time) { _time = time; }
57  bool isRemote() { return true; }
58  int fillRemoteVertexArrays(std::string &options)
59  {
60  GmshServer *server = _remote->getGmshServer();
61  if(!server) {
62  Msg::Error("Remote server not running: please start server");
63  return 1;
64  }
65  setDirty(true);
66  server->SendString(GmshSocket::GMSH_VERTEX_ARRAY, options.c_str());
67  return 1;
68  }
69 };
70 
71 #endif
GmshSocket::GMSH_VERTEX_ARRAY
@ GMSH_VERTEX_ARRAY
Definition: GmshSocket.h:74
PViewDataRemote::getTime
double getTime(int step)
Definition: PViewDataRemote.h:50
PViewDataRemote::getNumTimeSteps
int getNumTimeSteps()
Definition: PViewDataRemote.h:38
Msg::Error
static void Error(const char *fmt,...)
Definition: GmshMessage.cpp:482
PViewDataRemote::getMin
double getMin(int step=-1, bool onlyVisible=false, int tensorRep=0, int forceNumComponents=0, int componentMap[9]=nullptr)
Definition: PViewDataRemote.h:39
PViewDataRemote::setMax
void setMax(double max)
Definition: PViewDataRemote.h:54
PViewDataRemote::_bbox
SBoundingBox3d _bbox
Definition: PViewDataRemote.h:23
GmshMessage.h
PViewDataRemote::_numTimeSteps
int _numTimeSteps
Definition: PViewDataRemote.h:21
PViewData.h
PViewDataRemote::finalize
bool finalize(bool computeMinMax=true, const std::string &interpolationScheme="")
Definition: PViewDataRemote.h:33
GmshServer
Definition: GmshSocket.h:338
PViewDataRemote::_min
double _min
Definition: PViewDataRemote.h:20
PViewDataRemote::_max
double _max
Definition: PViewDataRemote.h:20
PViewDataRemote::~PViewDataRemote
~PViewDataRemote()
Definition: PViewDataRemote.h:32
PViewDataRemote::setTime
void setTime(double time)
Definition: PViewDataRemote.h:56
SBoundingBox3d.h
PViewDataRemote::getNumElements
int getNumElements(int step=-1, int ent=-1)
Definition: PViewDataRemote.h:52
onelab.h
PViewDataRemote::_remote
onelab::localNetworkClient * _remote
Definition: PViewDataRemote.h:19
onelab::localNetworkClient
Definition: onelab.h:1471
PViewData::setDirty
virtual void setDirty(bool val)
Definition: PViewData.h:63
PViewDataRemote::_time
double _time
Definition: PViewDataRemote.h:22
PViewData
Definition: PViewData.h:29
PViewDataRemote
Definition: PViewDataRemote.h:17
PViewDataRemote::isRemote
bool isRemote()
Definition: PViewDataRemote.h:57
PViewDataRemote::setBoundingBox
void setBoundingBox(SBoundingBox3d &bbox)
Definition: PViewDataRemote.h:55
PViewDataRemote::getMax
double getMax(int step=-1, bool onlyVisible=false, int tensorRep=0, int forceNumComponents=0, int componentMap[9]=nullptr)
Definition: PViewDataRemote.h:44
PViewDataRemote::setMin
void setMin(double min)
Definition: PViewDataRemote.h:53
PViewDataRemote::getBoundingBox
SBoundingBox3d getBoundingBox(int step=-1)
Definition: PViewDataRemote.h:49
PViewDataRemote::PViewDataRemote
PViewDataRemote(onelab::localNetworkClient *remote, double min, double max, int numsteps, double time, SBoundingBox3d &bbox)
Definition: PViewDataRemote.h:26
onelab::localNetworkClient::getGmshServer
GmshServer * getGmshServer()
Definition: onelab.h:1512
SBoundingBox3d
Definition: SBoundingBox3d.h:21
PViewDataRemote::fillRemoteVertexArrays
int fillRemoteVertexArrays(std::string &options)
Definition: PViewDataRemote.h:58
GmshSocket::SendString
void SendString(int type, const char *str)
Definition: GmshSocket.h:194