File: get_data_perf.cpp

package info (click to toggle)
gmsh 4.15.1%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 52,880 kB
  • sloc: cpp: 440,657; ansic: 114,930; f90: 15,611; python: 13,907; yacc: 7,438; java: 3,491; lisp: 3,206; lex: 633; perl: 571; makefile: 500; xml: 414; sh: 407; javascript: 113; modula3: 32
file content (38 lines) | stat: -rw-r--r-- 1,191 bytes parent folder | download | duplicates (4)
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
#include <iostream>
#include <gmsh.h>

int main(int argc, char **argv)
{
  gmsh::initialize(argc, argv);

  // create a simple cartesian grid (you can make it finer e.g. by passing
  // "-clscale 0.01" on the command line)
  gmsh::model::add("square");
  gmsh::model::occ::addRectangle(0, 0, 0, 1, 1, 100);
  gmsh::model::occ::synchronize();
  gmsh::model::mesh::setTransfiniteSurface(100);
  gmsh::model::mesh::generate(2);

  // create a post-processing dataset
  gmsh::plugin::setNumber("NewView", "Value", 1.234);
  int t = gmsh::plugin::run("NewView");

  // retrieve the dataset as a vector of vectors (one per tag)
  std::string type;
  std::vector<std::size_t> tags;
  std::vector<std::vector<double> > data;
  double time;
  int numComp;
  std::cout << "before get" << std::endl;
  gmsh::view::getModelData(t, 0, type, tags, data, time, numComp);
  std::cout << "after get" << std::endl;

  // retrieve the dataset as a single vector
  std::vector<double> data2;
  std::cout << "before getHomogeneous" << std::endl;
  gmsh::view::getHomogeneousModelData(t, 0, type, tags, data2, time, numComp);
  std::cout << "after getHomogeneous" << std::endl;

  gmsh::finalize();
  return 0;
}