File: paradis_c_interface.C

package info (click to toggle)
paraview 4.0.1-1~bpo70%2B1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy-backports
  • size: 526,572 kB
  • sloc: cpp: 2,284,430; ansic: 816,374; python: 239,936; xml: 70,162; tcl: 48,295; fortran: 39,116; yacc: 5,466; java: 3,518; perl: 3,107; lex: 1,620; sh: 1,555; makefile: 932; asm: 471; pascal: 228
file content (165 lines) | stat: -rw-r--r-- 3,850 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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*!
  Implements the pure C interface to paraDIS lib, but is a C++ file.  
*/ 
#include "paradis.h"
#include "paradis_c_interface.h"

extern "C" {
static paraDIS::DataSet *gDataSet = NULL; 

#define PARADIS_INIT if (!gDataSet)  gDataSet = new paraDIS::DataSet     

  void paraDIS_init(void) {
    PARADIS_INIT;
  }

  void paraDIS_close(void) {
    if (gDataSet) delete gDataSet; 
    gDataSet = NULL;
  }

  void paraDIS_SetVerbosity(int level, const char *filename){
    PARADIS_INIT;    
    gDataSet->SetVerbosity(level, filename); 
    return; 
  }
  
  void paraDIS_SetThreshold(double threshold){
    PARADIS_INIT;
    gDataSet->SetThreshold(threshold); 
    return; 
  }
  void paraDIS_EnableDebugOutput(int truth){
    PARADIS_INIT;
    gDataSet->EnableDebugOutput(truth); 
    return; 
  }
  
  void paraDIS_SetDataFile(const char *filename){
    PARADIS_INIT;
    gDataSet->SetDataFile(filename);    
    return; 
  } 
  
  void paraDIS_Clear(void){
    PARADIS_INIT;
    gDataSet->Clear(); 
    return; 
  }
   
   int paraDIS_GetBounds(double xxyyzz[6]){
    PARADIS_INIT;
    rclib::Point<float> datamin, datamax;   
    try {
      gDataSet->GetBounds(datamin, datamax); 
    } catch (string err) {
      dbprintf(1, "%s\n", err.c_str()); // << endl;     
      return 0;     
    }
    int i=3; while (i--) {
      xxyyzz[2*i] = datamin[i]; 
      xxyyzz[2*i+1] = datamax[i]; 
    }
    return 1; 
  }
   
  
  void paraDIS_SetSubspace(double xxyyzz[6]){
    PARADIS_INIT;
    rclib::Point<float> datamin, datamax;
    int i=3; while (i--) {
      datamin[i] = xxyyzz[2*i]; 
      datamax[i] = xxyyzz[2*i+1]; 
    }
    gDataSet->SetSubspace(datamin, datamax); 
    return; 
  }
   
  void paraDIS_TestRestrictSubspace(void) {
    gDataSet->TestRestrictSubspace(); 
    return; 
  } 
     
  
  void paraDIS_SetProcNum(int procnum, int numprocs){
    PARADIS_INIT;
    gDataSet->SetProcNum(procnum, numprocs); 
    return; 
  }
  
  
  void paraDIS_ReadData(void){
    PARADIS_INIT;
    gDataSet->ReadData(); 
    return; 
  }
  
  void paraDIS_PrintArmStats(void) {
    PARADIS_INIT; 
    gDataSet->PrintArmStats(); 
  }

  uint32_t paraDIS_GetNumNodes(void){
    PARADIS_INIT;
    return gDataSet->GetNumNodes();  
  }
  
  void paraDIS_printNodeVerbose(uint32_t nodenum){
    PARADIS_INIT;
    cout << gDataSet->GetNode(nodenum)->Stringify() << endl; 
  }

  void paraDIS_GetNodeLocation(uint32_t nodenum, float loc[3]){    
    PARADIS_INIT;
    gDataSet->GetNode(nodenum)->GetLocation(loc); 
    return; 
  }
  
  int8_t paraDIS_GetNodeType(uint32_t nodenum){
    PARADIS_INIT;
    return gDataSet->GetNode(nodenum)->GetNodeType(); 
  }  
    
  int8_t paraDIS_GetNumNodeNeighbors(uint32_t nodenum){
    PARADIS_INIT;
    return gDataSet->GetNode(nodenum)->GetNumNeighbors(); 
  }  

  int32_t  paraDIS_GetNodeSimulationDomain(uint32_t nodenum){
    PARADIS_INIT;
    return gDataSet->GetNode(nodenum)->GetNodeSimulationDomain(); 
  }
  
  int32_t  paraDIS_GetNodeSimulationID(uint32_t nodenum){
    PARADIS_INIT;
    return gDataSet->GetNode(nodenum)->GetNodeSimulationID(); 
  }  
  
  uint32_t paraDIS_GetNumArmSegments(void){
     PARADIS_INIT;
   return gDataSet->GetNumArmSegments(); 
  }
  
  void paraDIS_printArmSegmentVerbose(uint32_t segnum){
    PARADIS_INIT;
    cout << gDataSet->GetArmSegment(segnum)->Stringify() << endl; 
  }

  int8_t paraDIS_GetSegmentBurgersType(uint32_t segmentnum) {
    PARADIS_INIT;
    return gDataSet->GetArmSegment(segmentnum)->GetBurgersType(); 
  }  
  
  int8_t paraDIS_GetSegmentMNType(uint32_t segmentnum) {
    PARADIS_INIT;
    return gDataSet->GetArmSegment(segmentnum)->GetMNType(); 
  }  
  
  int32_t paraDIS_GetEndpointIndex(uint32_t segmentnum, int endpointnum){
    PARADIS_INIT;
    return gDataSet->GetArmSegment(segmentnum)->GetNodeIndex(endpointnum);  
  }
  
  

}