Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
hdf2vtk.C File Reference
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <cstring>
#include <cstdlib>
#include "Rocin.h"
#include "roccom.h"
Include dependency graph for hdf2vtk.C:

Go to the source code of this file.

Classes

struct  AttrInfo
 
struct  ConnInfo
 

Macros

#define VTK_EMPTY_CELL   0
 
#define VTK_VERTEX   1
 
#define VTK_POLY_VERTEX   2
 
#define VTK_LINE   3
 
#define VTK_POLY_LINE   4
 
#define VTK_TRIANGLE   5
 
#define VTK_TRIANGLE_STRIP   6
 
#define VTK_POLYGON   7
 
#define VTK_PIXEL   8
 
#define VTK_QUAD   9
 
#define VTK_TETRA   10
 
#define VTK_VOXEL   11
 
#define VTK_HEXAHEDRON   12
 
#define VTK_WEDGE   13
 
#define VTK_PYRAMID   14
 
#define VTK_PENTAGONAL_PRISM   15
 
#define VTK_HEXAGONAL_PRISM   16
 
#define VTK_QUADRATIC_EDGE   21
 
#define VTK_QUADRATIC_TRIANGLE   22
 
#define VTK_QUADRATIC_QUAD   23
 
#define VTK_QUADRATIC_TETRA   24
 
#define VTK_QUADRATIC_HEXAHEDRON   25
 
#define VTK_QUADRATIC_WEDGE   26
 
#define VTK_QUADRATIC_PYRAMID   27
 
#define VTK_CONVEX_POINT_SET   41
 
#define VTK_PARAMETRIC_CURVE   51
 
#define VTK_PARAMETRIC_SURFACE   52
 
#define VTK_PARAMETRIC_TRI_SURFACE   53
 
#define VTK_PARAMETRIC_QUAD_SURFACE   54
 
#define VTK_PARAMETRIC_TETRA_REGION   55
 
#define VTK_PARAMETRIC_HEX_REGION   56
 
#define SwitchOnDataType(dType, funcCall)
 

Functions

template<typename TT >
void PrintStructured (const TT **pData, int nComp, int ndims, const int *dims_nodes, int ghost, char loc, std::ostream &out)
 
template<typename TT >
void PrintUnstructured (const TT **pData, int nComp, int size, std::ostream &out)
 
void PrintConn (const int *pConn, const ConnInfo &ci, std::ostream &out)
 
void COM_print_window (const std::string &wName, const std::string &timeStr, const std::string &file_in, bool mesh_only)
 
 COM_EXTERN_MODULE (Rocin)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

#define SwitchOnDataType (   dType,
  funcCall 
)

Definition at line 81 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_CONVEX_POINT_SET   41

Definition at line 70 of file hdf2vtk.C.

#define VTK_EMPTY_CELL   0

Definition at line 42 of file hdf2vtk.C.

#define VTK_HEXAGONAL_PRISM   16

Definition at line 58 of file hdf2vtk.C.

#define VTK_HEXAHEDRON   12

Definition at line 54 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_LINE   3

Definition at line 45 of file hdf2vtk.C.

#define VTK_PARAMETRIC_CURVE   51

Definition at line 73 of file hdf2vtk.C.

#define VTK_PARAMETRIC_HEX_REGION   56

Definition at line 78 of file hdf2vtk.C.

#define VTK_PARAMETRIC_QUAD_SURFACE   54

Definition at line 76 of file hdf2vtk.C.

#define VTK_PARAMETRIC_SURFACE   52

Definition at line 74 of file hdf2vtk.C.

#define VTK_PARAMETRIC_TETRA_REGION   55

Definition at line 77 of file hdf2vtk.C.

#define VTK_PARAMETRIC_TRI_SURFACE   53

Definition at line 75 of file hdf2vtk.C.

#define VTK_PENTAGONAL_PRISM   15

Definition at line 57 of file hdf2vtk.C.

#define VTK_PIXEL   8

Definition at line 50 of file hdf2vtk.C.

#define VTK_POLY_LINE   4

Definition at line 46 of file hdf2vtk.C.

#define VTK_POLY_VERTEX   2

Definition at line 44 of file hdf2vtk.C.

#define VTK_POLYGON   7

Definition at line 49 of file hdf2vtk.C.

#define VTK_PYRAMID   14

Definition at line 56 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUAD   9

Definition at line 51 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_EDGE   21

Definition at line 61 of file hdf2vtk.C.

#define VTK_QUADRATIC_HEXAHEDRON   25

Definition at line 65 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_PYRAMID   27

Definition at line 67 of file hdf2vtk.C.

#define VTK_QUADRATIC_QUAD   23

Definition at line 63 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_TETRA   24

Definition at line 64 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_TRIANGLE   22

Definition at line 62 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_WEDGE   26

Definition at line 66 of file hdf2vtk.C.

#define VTK_TETRA   10

Definition at line 52 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_TRIANGLE   5

Definition at line 47 of file hdf2vtk.C.

Referenced by COM_print_window().

#define VTK_TRIANGLE_STRIP   6

Definition at line 48 of file hdf2vtk.C.

#define VTK_VERTEX   1

Definition at line 43 of file hdf2vtk.C.

#define VTK_VOXEL   11

Definition at line 53 of file hdf2vtk.C.

#define VTK_WEDGE   13

Definition at line 55 of file hdf2vtk.C.

Referenced by COM_print_window().

Function Documentation

COM_EXTERN_MODULE ( Rocin  )
void COM_print_window ( const std::string &  wName,
const std::string &  timeStr,
const std::string &  file_in,
bool  mesh_only 
)

Definition at line 222 of file hdf2vtk.C.

References COM_BYTE, COM_CHAR, COM_DOUBLE, COM_FLOAT, COM_free_buffer(), COM_get_attribute(), COM_get_attributes(), COM_get_connectivities(), COM_get_panes(), COM_get_size(), COM_INT, COM_LONG, COM_LONG_DOUBLE, COM_SHORT, COM_UNSIGNED, COM_UNSIGNED_CHAR, COM_UNSIGNED_LONG, COM_UNSIGNED_SHORT, i, paneIds, PrintConn(), PrintStructured(), PrintUnstructured(), sin, SwitchOnDataType, VTK_HEXAHEDRON, VTK_PYRAMID, VTK_QUAD, VTK_QUADRATIC_HEXAHEDRON, VTK_QUADRATIC_QUAD, VTK_QUADRATIC_TETRA, VTK_QUADRATIC_TRIANGLE, VTK_TETRA, VTK_TRIANGLE, VTK_WEDGE, and x.

224 {
225  static std::map<int, std::string> DataTypeAsString;
226  static std::map<std::string, int> COM2VTK;
227  if (DataTypeAsString.empty()) {
228  DataTypeAsString[COM_CHAR] = "char";
229  DataTypeAsString[COM_BYTE] = "char";
230  DataTypeAsString[COM_UNSIGNED_CHAR] = "unsigned_char";
231  DataTypeAsString[COM_SHORT] = "short";
232  DataTypeAsString[COM_UNSIGNED_SHORT] = "unsigned_short";
233  DataTypeAsString[COM_INT] = "int";
234  DataTypeAsString[COM_UNSIGNED] = "unsigned_int";
235  DataTypeAsString[COM_LONG] = "long";
236  DataTypeAsString[COM_UNSIGNED_LONG] = "unsigned_long";
237  DataTypeAsString[COM_FLOAT] = "float";
238  DataTypeAsString[COM_DOUBLE] = "double";
239  DataTypeAsString[COM_LONG_DOUBLE] = "double"; // Not really, but...
240  }
241 
242  if (COM2VTK.empty()) {
243  COM2VTK["t3"] = VTK_TRIANGLE;
244  COM2VTK["t6"] = VTK_QUADRATIC_TRIANGLE;
245  COM2VTK["q4"] = VTK_QUAD;
246  COM2VTK["q8"] = VTK_QUADRATIC_QUAD;
247  COM2VTK["q9"] = VTK_QUADRATIC_QUAD;
248  COM2VTK["T4"] = VTK_TETRA;
249  COM2VTK["T10"] = VTK_QUADRATIC_TETRA;
250  COM2VTK["B8"] = VTK_HEXAHEDRON;
251  COM2VTK["H8"] = VTK_HEXAHEDRON;
252  COM2VTK["B20"] = VTK_QUADRATIC_HEXAHEDRON;
253  COM2VTK["P5"] = VTK_PYRAMID;
254  COM2VTK["W6"] = VTK_WEDGE;
255  COM2VTK["P6"] = VTK_WEDGE;
256  }
257 
258  // Obtain the list of panes
259  int nPanes;
260  int* paneIds;
261  COM_get_panes(wName.c_str(), &nPanes, &paneIds);
262 
263  // Obtain the list of attributes
264  int nAttrs; // Number of attributes
265  char* attrStr; // names of attributes separated by spaces
266  COM_get_attributes(wName.c_str(), &nAttrs, &attrStr);
267 
268  // First get the nodal coordinate info.
269  int i;
270  std::string name;
271  std::vector<AttrInfo> attrs(nAttrs+1);
272  attrs[0].m_name = "nc";
273  COM_get_attribute((wName + '.' + attrs[0].m_name).c_str(),
274  &(attrs[0].m_location), &(attrs[0].m_dataType),
275  &(attrs[0].m_numComp), &(attrs[0].m_units));
276 
277  // Then get the basic attribute info.
278  {
279  std::istringstream sin(attrStr);
280  for (i=1; i<nAttrs+1; ++i) {
281  sin >> attrs[i].m_name;
282  COM_get_attribute((wName + '.' + attrs[i].m_name).c_str(),
283  &(attrs[i].m_location), &(attrs[i].m_dataType),
284  &(attrs[i].m_numComp), &(attrs[i].m_units));
285  }
286  }
287 
288  // Eliminate window and pane attributes. Count node and element attributes.
289  std::set<char> locset;
290  std::vector<AttrInfo>::iterator p = attrs.begin();
291  ++p;
292  while (p != attrs.end()) {
293  char loc = (*p).m_location;
294  if (loc == 'w' || loc == 'p') {
295  p = attrs.erase(p);
296  continue;
297  }
298  locset.insert(loc);
299  ++p;
300  }
301 
302  // Loop through the panes to find the meshes
303  for (i=0; i<nPanes; ++i) {
304  std::ofstream out;
305  if (nPanes == 1) {
306  std::string file_out(file_in.substr(0, file_in.rfind('.')) + ".vtk");
307  out.open(file_out.c_str());
308  } else {
309  std::ostringstream sout;
310  sout << wName << '_' << timeStr << "_"
311  << std::setw(4) << std::setfill('0') << i << ".vtk";
312  out.open(sout.str().c_str());
313  }
314 
315  out << "# vtk DataFile Version 2.0" << std::endl;
316  out << "Material=" << wName << ", Block=" << i << ", Time: " << timeStr
317  << "." << std::endl;
318  out << "ASCII" << std::endl;
319 
320  // Obtain the size of nodes
321  int nNodes; // total number of nodes
322  int ghost; // Number of ghost nodes
323  name = wName + ".nc";
324  COM_get_size(name.c_str(), paneIds[i], &nNodes, &ghost);
325  nNodes -= ghost;
326 
327  // Obtain the connectivity tables
328  int nConn; // Number of connectivity tables
329  char* connNames; // Names of connectivity tables separated by space
330  COM_get_connectivities(wName.c_str(), paneIds[i], &nConn, &connNames);
331 
332  const int* dims = NULL;
333  int ndims, eTotal = 0, eSize = 0;
334  std::vector<ConnInfo> connInfo(nConn);
335  std::vector<std::pair<int, int> > cellTypes;
336  if (nConn == 1 && strncmp(connNames, ":st", 3) == 0) { // Structured mesh
337  name = wName + '.' + connNames;
338  COM_get_size(name.c_str(), paneIds[i], &ndims, &ghost);
339 
340  // Obtain the dimensions (must be a const array) of the pane
341  COM_get_array_const(name.c_str(), paneIds[i], &dims);
342 
343  out << "DATASET STRUCTURED_GRID" << std::endl;
344  out << "DIMENSIONS " << dims[0] - 2 * ghost << " " << dims[1] - 2 * ghost
345  << " " << dims[2] - 2 * ghost << std::endl;
346 
347  eTotal = (dims[0] - 2 * ghost > 1 ? dims[0] - 2 * ghost - 1 : 1)
348  * (dims[1] - 2 * ghost > 1 ? dims[1] - 2 * ghost - 1 : 1)
349  * (dims[2] - 2 * ghost > 1 ? dims[2] - 2 * ghost - 1 : 1);
350  } else { // Unstructured mesh
351  out << "DATASET UNSTRUCTURED_GRID" << std::endl;
352  // Obtain the sizes of connectivity tables
353  std::istringstream sin(connNames);
354  std::vector<ConnInfo>::iterator c;
355  for (c=connInfo.begin(); c!=connInfo.end(); ++c) {
356  sin >> (*c).m_type;
357  (*c).m_name = wName + '.' + (*c).m_type;
358  (*c).m_type.erase(0, 1);
359  std::string::size_type x = (*c).m_type.find(':', 2);
360  if (x != std::string::npos)
361  (*c).m_type.erase(x);
362 
363  COM_get_size((*c).m_name.c_str(), paneIds[i], &((*c).m_numElements),
364  &((*c).m_numGhost));
365  eTotal += (*c).m_numElements - (*c).m_numGhost;
366 
367  int nn;
368  if ((*c).m_type == "q9")
369  nn = 8;
370  else {
371  std::istringstream sin((*c).m_type.substr(1));
372  sin >> nn;
373  }
374  eSize += ((*c).m_numElements - (*c).m_numGhost) * (nn + 1);
375 
376  cellTypes.push_back(std::pair<int, int>(COM2VTK[(*c).m_type],
377  (*c).m_numElements - (*c).m_numGhost));
378  }
379  }
380 
381  out << "POINTS " << nNodes << ' ' << DataTypeAsString[attrs[0].m_dataType]
382  << std::endl;
383  const void* pArray[9] = { NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
384  NULL };
385  p = attrs.begin();
386  int comp;
387  for (comp=1; comp<=(*p).m_numComp; ++comp) {
388  std::ostringstream sout;
389  sout << wName << '.' << comp << '-' << (*p).m_name;
390  COM_get_array_const(sout.str().c_str(), paneIds[i], &(pArray[comp-1]));
391  }
392 
393  if (dims != NULL) { // Structured
394  SwitchOnDataType((*p).m_dataType,
395  PrintStructured((const TT**)pArray, (*p).m_numComp,
396  ndims, dims, ghost, (*p).m_location,
397  out));
398  } else {
399  SwitchOnDataType((*p).m_dataType,
400  PrintUnstructured((const TT**)pArray, (*p).m_numComp,
401  nNodes, out));
402  }
403 
404  if (nConn != 1 || strncmp(connNames, ":st", 3) != 0) { // Unstructured mesh
405  out << "CELLS " << eTotal << ' ' << eSize << std::endl;
406 
407  std::vector<ConnInfo>::iterator c;
408  for (c=connInfo.begin(); c!=connInfo.end(); ++c) {
409  const int* pConn = NULL;
410  COM_get_array_const((*c).m_name.c_str(), paneIds[i], &pConn);
411  PrintConn(pConn, *c, out);
412  }
413 
414  out << "CELL_TYPES " << eTotal << std::endl;
415 
416  int i;
417  std::vector<std::pair<int, int> >::iterator t = cellTypes.begin();
418  while (t != cellTypes.end()) {
419  for (i=0; i<(*t).second; ++i)
420  out << (*t).first << std::endl;
421  ++t;
422  }
423  }
424 
425  // free the buffer of connNames
426  COM_free_buffer(&connNames);
427 
428  if (!mesh_only && locset.count('n') > 0) {
429  out << "POINT_DATA " << nNodes << std::endl;
430  for (p=attrs.begin(); p!=attrs.end(); ++p) {
431  if ((*p).m_location != 'n')
432  continue;
433 
434  if ((*p).m_numComp == 1) {
435  COM_get_array_const((wName + '.' + (*p).m_name).c_str(), paneIds[i],
436  &(pArray[0]));
437  out << "SCALARS ";
438  } else {
439  int comp;
440  for (comp=1; comp<=(*p).m_numComp; ++comp) {
441  std::ostringstream sout;
442  sout << wName << '.' << comp << '-' << (*p).m_name;
443  COM_get_array_const(sout.str().c_str(), paneIds[i],
444  &(pArray[comp-1]));
445  }
446  if ((*p).m_numComp == 3)
447  out << "VECTORS ";
448  else
449  out << "TENSORS ";
450  }
451 
452  out << (*p).m_name << ' ' << DataTypeAsString[(*p).m_dataType]
453  << std::endl;
454 
455  if ((*p).m_numComp == 1)
456  out << "LOOKUP_TABLE default" << std::endl;
457 
458  if (dims != NULL) { // Structured
459  SwitchOnDataType((*p).m_dataType,
460  PrintStructured((const TT**)pArray, (*p).m_numComp,
461  ndims, dims, ghost, (*p).m_location,
462  out));
463  } else {
464  SwitchOnDataType((*p).m_dataType,
465  PrintUnstructured((const TT**)pArray, (*p).m_numComp,
466  nNodes, out));
467  }
468  }
469  }
470 
471  if (!mesh_only && locset.count('e') > 0) {
472  out << std::endl << "CELL_DATA " << eTotal << std::endl;
473  for (p=attrs.begin(); p!=attrs.end(); ++p) {
474  if ((*p).m_location != 'e')
475  continue;
476 
477  if ((*p).m_numComp == 1) {
478  COM_get_array_const((wName + '.' + (*p).m_name).c_str(), paneIds[i],
479  &(pArray[0]));
480  out << "SCALARS ";
481  } else {
482  int comp;
483  for (comp=1; comp<=(*p).m_numComp; ++comp) {
484  std::ostringstream sout;
485  sout << wName << '.' << comp << '-' << (*p).m_name;
486  COM_get_array_const(sout.str().c_str(), paneIds[i],
487  &(pArray[comp-1]));
488  }
489  if ((*p).m_numComp == 3)
490  out << "VECTORS ";
491  else
492  out << "TENSORS ";
493  }
494 
495  out << (*p).m_name << ' ' << DataTypeAsString[(*p).m_dataType]
496  << std::endl;
497 
498  if ((*p).m_numComp == 1)
499  out << "LOOKUP_TABLE default" << std::endl;
500 
501  if (dims != NULL) { // Structured
502  SwitchOnDataType((*p).m_dataType,
503  PrintStructured((const TT**)pArray, (*p).m_numComp,
504  ndims, dims, ghost, (*p).m_location,
505  out));
506  } else {
507  SwitchOnDataType((*p).m_dataType,
508  PrintUnstructured((const TT**)pArray, (*p).m_numComp,
509  eTotal, out));
510  }
511  }
512  }
513  }
514 
515  // Free buffers for pane ids and attribute names
516  COM_free_buffer(&paneIds);
517  COM_free_buffer(&attrStr);
518 }
#define VTK_QUADRATIC_TETRA
Definition: hdf2vtk.C:64
void PrintConn(const int *pConn, const ConnInfo &ci, std::ostream &out)
Definition: cgns2smf.C:232
#define VTK_QUAD
Definition: hdf2vtk.C:51
void COM_get_attribute(const std::string wa_str, char *loc, int *type, int *ncomp, std::string *unit)
Definition: roccom_c++.h:269
#define VTK_QUADRATIC_TRIANGLE
Definition: hdf2vtk.C:62
#define VTK_PYRAMID
Definition: hdf2vtk.C:56
void PrintUnstructured(const TT **pData, int nComp, int size, std::ostream &out)
Definition: cgns2smf.C:221
void PrintStructured(const TT **pData, int nComp, int ndims, const int *dims_nodes, int ghost, char loc, std::ostream &out)
Definition: cgns2smf.C:176
C/C++ Data types.
Definition: roccom_basic.h:129
#define VTK_TRIANGLE
Definition: hdf2vtk.C:47
void COM_get_connectivities(const char *wname, int pane_id, int *nc, std::string &names)
Definition: roccom_c++.h:363
void COM_get_attributes(const char *wname, int *na, std::string &names)
Definition: roccom_c++.h:360
NT & sin
#define VTK_TETRA
Definition: hdf2vtk.C:52
blockLoc i
Definition: read.cpp:79
void int int REAL * x
Definition: read.cpp:74
void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute.
Definition: roccom_c++.h:274
#define VTK_WEDGE
Definition: hdf2vtk.C:55
#define SwitchOnDataType(dType, funcCall)
Definition: hdf2vtk.C:81
void COM_get_panes(const char *wname, std::vector< int > &pane_ids, int rank=-2)
Definition: roccom_c++.h:350
void COM_free_buffer(int **buf)
Definition: roccom_c++.h:397
#define VTK_HEXAHEDRON
Definition: hdf2vtk.C:54
#define VTK_QUADRATIC_HEXAHEDRON
Definition: hdf2vtk.C:65
#define VTK_QUADRATIC_QUAD
Definition: hdf2vtk.C:63
std::vector< int > paneIds
Array of paneIds.
Definition: hdf2pltV2.C:60

Here is the call graph for this function:

int main ( int  argc,
char *  argv[] 
)

Definition at line 522 of file hdf2vtk.C.

References COM_call_function(), COM_finalize(), COM_get_attribute_handle(), COM_get_function_handle(), COM_init(), COM_LOAD_MODULE_STATIC_DYNAMIC, COM_print_window(), COM_set_profiling(), COM_set_verbose(), COM_UNLOAD_MODULE_STATIC_DYNAMIC, and i.

523 {
524  COM_init(&argc, &argv);
525 
526  bool mesh_only = false, read_control = false;
527  int i;
528  for (i=1; i<argc-1; ++i) {
529  if (std::strcmp(argv[1], "-c") == 0)
530  read_control = true;
531  else if (std::strcmp(argv[1], "-meshonly") == 0)
532  mesh_only = true;
533  else {
534  std::cerr << "Usage: hdf2vtk [-meshonly] <hdf file>" << std::endl;
535  std::cerr << " hdf2vtk [-meshonly] -c <control file>" << std::endl;
536  return 1;
537  }
538  }
539 
541 
542  int IN_obtain = COM_get_function_handle("IN.obtain_attribute");
543 
544  COM_set_verbose(0);
546 
547  std::string file_in(argv[argc-1]);
548  std::string win_in(file_in);
549  std::string::size_type st = win_in.find_last_of('/');
550  if (st != std::string::npos)
551  win_in.erase(0, st+1);
552  st = win_in.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
553  if (st != std::string::npos)
554  win_in.erase(st);
555 
556  int len = 15;
557  char timeStr[16] = "";
558 
559  if (read_control) {
560  std::cerr << "Reading by control file " << file_in
561  << " into window " << win_in << std::endl;
562 
563  int IN_read = COM_get_function_handle("IN.read_by_control_file");
564  COM_call_function(IN_read, file_in.c_str(), win_in.c_str(), NULL,
565  timeStr, &len);
566  } else {
567  std::cerr << "Reading HDF file(s) " << file_in
568  << " into window " << win_in << std::endl;
569 
570  int IN_read = COM_get_function_handle("IN.read_window");
571  COM_call_function(IN_read, file_in.c_str(), win_in.c_str(), NULL, NULL,
572  timeStr, &len);
573  }
574 
575  int IN_all = COM_get_attribute_handle((win_in + ".all").c_str());
576  COM_call_function(IN_obtain, &IN_all, &IN_all);
577 
578  COM_print_window(win_in, timeStr, file_in, mesh_only);
579 
580 #ifdef DUMMY_MPI
582 #endif // DUMMY_MPI
583 
584  COM_finalize();
585  return 0;
586 }
void COM_print_window(const char *wName, std::ostream &ostr)
Print a terse human-readable description of this window to this ostream.
Definition: printin.C:64
void COM_set_verbose(int i)
Definition: roccom_c++.h:543
int COM_get_attribute_handle(const char *waname)
Definition: roccom_c++.h:412
#define COM_UNLOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:113
void COM_finalize()
Definition: roccom_c++.h:59
Definition: Rocin.h:64
blockLoc i
Definition: read.cpp:79
void COM_set_profiling(int i)
Definition: roccom_c++.h:550
void COM_call_function(const int wf, int argc,...)
Definition: roccom_c.C:48
void COM_init(int *argc, char ***argv)
Definition: roccom_c++.h:57
#define COM_LOAD_MODULE_STATIC_DYNAMIC(moduleName, windowString)
Definition: roccom_basic.h:111
int COM_get_function_handle(const char *wfname)
Definition: roccom_c++.h:428

Here is the call graph for this function:

void PrintConn ( const int *  pConn,
const ConnInfo ci,
std::ostream &  out 
)

Definition at line 201 of file hdf2vtk.C.

References i, ConnInfo::m_numElements, ConnInfo::m_numGhost, ConnInfo::m_type, and sin.

202 {
203  int nn;
204  if (ci.m_type == "q9")
205  nn = 8;
206  else {
207  std::istringstream sin(ci.m_type.substr(1));
208  sin >> nn;
209  }
210 
211  int ne = ci.m_numElements - ci.m_numGhost;
212 
213  int elem, i;
214  for (elem=0; elem<ne; ++elem) {
215  out << nn;
216  for (i=0; i<nn; ++i)
217  out << ' ' << (pConn[elem+i*ci.m_numElements] - 1);
218  out << std::endl;
219  }
220 }
int m_numGhost
Definition: cgns2smf.C:140
std::string m_type
Definition: cgns2smf.C:138
NT & sin
blockLoc i
Definition: read.cpp:79
int m_numElements
Definition: cgns2smf.C:139
void PrintStructured ( const TT **  pData,
int  nComp,
int  ndims,
const int *  dims_nodes,
int  ghost,
char  loc,
std::ostream &  out 
)

Definition at line 146 of file hdf2vtk.C.

References i, j, and k.

149 {
150  const int dims[3] = { dims_nodes[0] - (loc == 'e'),
151  ndims >= 2 ? dims_nodes[1] - (loc == 'e') : 0,
152  ndims >= 3 ? dims_nodes[2] - (loc == 'e') : 0 };
153 
154  const int last[3] = { dims[0] - ghost,
155  ndims >= 2 ? dims[1] - ghost : 0,
156  ndims >= 3 ? dims[2] - ghost : 0 };
157 
158  int c, i, j, k;
159  switch (ndims) {
160  case 1:
161  for (i=ghost; i<last[0]; ++i) {
162  for (c=0; c<nComp; ++c)
163  out << (pData[c] ? pData[c][i] : (TT)-987654321) << ' ';
164  out << std::endl;
165  }
166  break;
167 
168  case 2:
169  for (j=ghost; j<last[1]; ++j)
170  for (i=ghost; i<last[0]; ++i) {
171  for (c=0; c<nComp; ++c)
172  out << (pData[c] ? pData[c][i+j*dims[0]] : (TT)-987654321) << ' ';
173  out << std::endl;
174  }
175  break;
176 
177  case 3:
178  for (k=ghost; k<last[2]; ++k)
179  for (j=ghost; j<last[1]; ++j)
180  for (i=ghost; i<last[0]; ++i) {
181  for (c=0; c<nComp; ++c)
182  out << (pData[c] ? pData[c][i+j*dims[0]+k*dims[0]*dims[1]]
183  : (TT)-987654321) << ' ';
184  out << std::endl;
185  }
186  break;
187  }
188 }
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6
void PrintUnstructured ( const TT **  pData,
int  nComp,
int  size,
std::ostream &  out 
)

Definition at line 191 of file hdf2vtk.C.

References i.

192 {
193  int c, i;
194  for (i=0; i<size; ++i) {
195  for (c=0; c<nComp; ++c)
196  out << (pData[c] ? pData[c][i] : (TT)-987654321) << ' ';
197  out << std::endl;
198  }
199 }
blockLoc i
Definition: read.cpp:79