File: PViewDataRemote.h

package info (click to toggle)
gmsh 4.8.4%2Bds2-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 87,812 kB
  • sloc: cpp: 378,014; ansic: 99,669; yacc: 7,216; python: 6,680; java: 3,486; lisp: 659; lex: 621; perl: 571; makefile: 470; sh: 440; xml: 415; javascript: 113; pascal: 35; modula3: 32
file content (71 lines) | stat: -rw-r--r-- 2,228 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Gmsh - Copyright (C) 1997-2021 C. Geuzaine, J.-F. Remacle
//
// See the LICENSE.txt file for license information. Please report all
// issues on https://gitlab.onelab.info/gmsh/gmsh/issues.

#ifndef PVIEW_DATA_REMOTE_H
#define PVIEW_DATA_REMOTE_H

#include <vector>
#include <string>
#include "GmshMessage.h"
#include "PViewData.h"
#include "SBoundingBox3d.h"
#include "onelab.h"

// The container for a remote dataset (does not contain any actual data)
class PViewDataRemote : public PViewData {
private:
  onelab::localNetworkClient *_remote;
  double _min, _max;
  int _numTimeSteps;
  double _time;
  SBoundingBox3d _bbox;

public:
  PViewDataRemote(onelab::localNetworkClient *remote, double min, double max,
                  int numsteps, double time, SBoundingBox3d &bbox)
    : _remote(remote), _min(min), _max(max), _numTimeSteps(numsteps),
      _time(time), _bbox(bbox)
  {
  }
  ~PViewDataRemote() {}
  bool finalize(bool computeMinMax = true,
                const std::string &interpolationScheme = "")
  {
    return true;
  }
  int getNumTimeSteps() { return _numTimeSteps; }
  double getMin(int step = -1, bool onlyVisible = false, int tensorRep = 0,
                int forceNumComponents = 0, int componentMap[9] = nullptr)
  {
    return _min;
  }
  double getMax(int step = -1, bool onlyVisible = false, int tensorRep = 0,
                int forceNumComponents = 0, int componentMap[9] = nullptr)
  {
    return _max;
  }
  SBoundingBox3d getBoundingBox(int step = -1) { return _bbox; }
  double getTime(int step) { return _time; }
  // need to return != 0 for "empty" tests
  int getNumElements(int step = -1, int ent = -1) { return -1; }
  void setMin(double min) { _min = min; }
  void setMax(double max) { _max = max; }
  void setBoundingBox(SBoundingBox3d &bbox) { _bbox = bbox; }
  void setTime(double time) { _time = time; }
  bool isRemote() { return true; }
  int fillRemoteVertexArrays(std::string &options)
  {
    GmshServer *server = _remote->getGmshServer();
    if(!server) {
      Msg::Error("Remote server not running: please start server");
      return 1;
    }
    setDirty(true);
    server->SendString(GmshSocket::GMSH_VERTEX_ARRAY, options.c_str());
    return 1;
  }
};

#endif