Rocstar  1.0
Rocstar multiphysics simulation application
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
cgns2smf.C File Reference
#include "Rocin.h"
#include "roccom.h"
#include <fstream>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
Include dependency graph for cgns2smf.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

bool rocElement2SMF (string rtype, string &etype)
 
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, std::ofstream &out)
 
 COM_EXTERN_MODULE (Rocin)
 
int main (int argc, char *argv[])
 

Macro Definition Documentation

#define SwitchOnDataType (   dType,
  funcCall 
)

Definition at line 77 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_CONVEX_POINT_SET   41

Definition at line 66 of file cgns2smf.C.

#define VTK_EMPTY_CELL   0

Definition at line 38 of file cgns2smf.C.

#define VTK_HEXAGONAL_PRISM   16

Definition at line 54 of file cgns2smf.C.

#define VTK_HEXAHEDRON   12

Definition at line 50 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_LINE   3

Definition at line 41 of file cgns2smf.C.

#define VTK_PARAMETRIC_CURVE   51

Definition at line 69 of file cgns2smf.C.

#define VTK_PARAMETRIC_HEX_REGION   56

Definition at line 74 of file cgns2smf.C.

#define VTK_PARAMETRIC_QUAD_SURFACE   54

Definition at line 72 of file cgns2smf.C.

#define VTK_PARAMETRIC_SURFACE   52

Definition at line 70 of file cgns2smf.C.

#define VTK_PARAMETRIC_TETRA_REGION   55

Definition at line 73 of file cgns2smf.C.

#define VTK_PARAMETRIC_TRI_SURFACE   53

Definition at line 71 of file cgns2smf.C.

#define VTK_PENTAGONAL_PRISM   15

Definition at line 53 of file cgns2smf.C.

#define VTK_PIXEL   8

Definition at line 46 of file cgns2smf.C.

#define VTK_POLY_LINE   4

Definition at line 42 of file cgns2smf.C.

#define VTK_POLY_VERTEX   2

Definition at line 40 of file cgns2smf.C.

#define VTK_POLYGON   7

Definition at line 45 of file cgns2smf.C.

#define VTK_PYRAMID   14

Definition at line 52 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUAD   9

Definition at line 47 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_EDGE   21

Definition at line 57 of file cgns2smf.C.

#define VTK_QUADRATIC_HEXAHEDRON   25

Definition at line 61 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_PYRAMID   27

Definition at line 63 of file cgns2smf.C.

#define VTK_QUADRATIC_QUAD   23

Definition at line 59 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_TETRA   24

Definition at line 60 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_TRIANGLE   22

Definition at line 58 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_QUADRATIC_WEDGE   26

Definition at line 62 of file cgns2smf.C.

#define VTK_TETRA   10

Definition at line 48 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_TRIANGLE   5

Definition at line 43 of file cgns2smf.C.

Referenced by COM_print_window().

#define VTK_TRIANGLE_STRIP   6

Definition at line 44 of file cgns2smf.C.

#define VTK_VERTEX   1

Definition at line 39 of file cgns2smf.C.

#define VTK_VOXEL   11

Definition at line 49 of file cgns2smf.C.

#define VTK_WEDGE   13

Definition at line 51 of file cgns2smf.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,
std::ofstream &  out 
)

Definition at line 259 of file cgns2smf.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.

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

555 {
556  COM_init(&argc, &argv);
557  bool fail = false;
558  bool mesh_only = false;
559  //bool read_control = false;
560  //int i;
561  if (std::strcmp(argv[1], "-meshonly") == 0)
562  {
563  mesh_only = true;
564  if (argc != 4)
565  fail = true;
566  }
567  else
568  {
569  if (argc != 3)
570  fail = true;
571  }
572 
573  if (fail)
574  {
575  std::cerr << "Usage: cgns2smf [-meshonly] <cgns file> <smf file>" << std::endl;
576  return 1;
577  }
578 
579  ofstream outfile(argv[argc-1], ios::out);
581 
582  int IN_obtain = COM_get_function_handle("IN.obtain_attribute");
583 
584  COM_set_verbose(0);
586 
587  std::string file_in(argv[argc-2]);
588  std::string win_in(file_in);
589  std::string::size_type st = win_in.find_last_of('/');
590  if (st != std::string::npos)
591  win_in.erase(0, st+1);
592  st = win_in.find_first_not_of("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ");
593  if (st != std::string::npos)
594  win_in.erase(st);
595 
596  int len = 15;
597  char timeStr[16] = "";
598 
599 
600  std::cout << "Reading CGNS file(s) " << file_in
601  << " into window " << win_in << std::endl;
602 
603  int IN_read = COM_get_function_handle("IN.read_window");
604  COM_call_function(IN_read, file_in.c_str(), win_in.c_str(), NULL, NULL,
605  timeStr, &len);
606 
607  cerr << "Finished reading CGNS file into window\n";
608  int IN_all = COM_get_attribute_handle((win_in + ".all").c_str());
609  COM_call_function(IN_obtain, &IN_all, &IN_all);
610 
611  std::cout << "Printing surface mesh to..." << argv[argc-1] << std::endl;
612  COM_print_window(win_in, timeStr, file_in, mesh_only,outfile);
613  std::cout << "Done" << std::endl;
614 
615 #ifdef DUMMY_MPI
617 #endif // DUMMY_MPI
618 
619  COM_finalize();
620  return 0;
621 }
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
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 232 of file cgns2smf.C.

References i, ConnInfo::m_numElements, ConnInfo::m_numGhost, ConnInfo::m_type, rocElement2SMF(), and sin.

Referenced by COM_print_window().

233 {
234  std::string etype;
235  int nn;
236  if (ci.m_type == "q9")
237  {
238  nn = 8;
239  }
240  else
241  {
242  std::istringstream sin(ci.m_type.substr(1));
243  sin >> nn;
244  }
245  rocElement2SMF(ci.m_type,etype);
246 
247  int ne = ci.m_numElements - ci.m_numGhost;
248 
249  int elem, i;
250  for (elem=0; elem<ne; ++elem) {
251  out << etype;
252  for (i=0; i<nn; ++i)
253  out << ' ' << (pConn[elem+i*ci.m_numElements]);
254  //out << ' ' << (pConn[elem+i*ci.m_numElements] - 1);
255  out << std::endl;
256  }
257 }
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
bool rocElement2SMF(string rtype, string &etype)
Definition: cgns2smf.C:143

Here is the call graph for this function:

Here is the caller graph for this function:

void PrintStructured ( const TT **  pData,
int  nComp,
int  ndims,
const int *  dims_nodes,
int  ghost,
char  loc,
std::ostream &  out 
)

Definition at line 176 of file cgns2smf.C.

References i, j, and k.

Referenced by COM_print_window().

179 {
180  const int dims[3] = { dims_nodes[0] - (loc == 'e'),
181  ndims >= 2 ? dims_nodes[1] - (loc == 'e') : 0,
182  ndims >= 3 ? dims_nodes[2] - (loc == 'e') : 0 };
183 
184  const int last[3] = { dims[0] - ghost,
185  ndims >= 2 ? dims[1] - ghost : 0,
186  ndims >= 3 ? dims[2] - ghost : 0 };
187 
188  int c, i, j, k;
189  switch (ndims) {
190  case 1:
191  for (i=ghost; i<last[0]; ++i) {
192  for (c=0; c<nComp; ++c)
193  out << (pData[c] ? pData[c][i] : (TT)-987654321) << ' ';
194  out << std::endl;
195  }
196  break;
197 
198  case 2:
199  for (j=ghost; j<last[1]; ++j)
200  for (i=ghost; i<last[0]; ++i) {
201  for (c=0; c<nComp; ++c)
202  out << (pData[c] ? pData[c][i+j*dims[0]] : (TT)-987654321) << ' ';
203  out << std::endl;
204  }
205  break;
206 
207  case 3:
208  for (k=ghost; k<last[2]; ++k)
209  for (j=ghost; j<last[1]; ++j)
210  for (i=ghost; i<last[0]; ++i) {
211  for (c=0; c<nComp; ++c)
212  out << (pData[c] ? pData[c][i+j*dims[0]+k*dims[0]*dims[1]]
213  : (TT)-987654321) << ' ';
214  out << std::endl;
215  }
216  break;
217  }
218 }
j indices k indices k
Definition: Indexing.h:6
blockLoc i
Definition: read.cpp:79
j indices j
Definition: Indexing.h:6

Here is the caller graph for this function:

void PrintUnstructured ( const TT **  pData,
int  nComp,
int  size,
std::ostream &  out 
)

Definition at line 221 of file cgns2smf.C.

References i.

Referenced by COM_print_window().

222 {
223  int c, i;
224  for (i=0; i<size; ++i) {
225  out << "v ";
226  for (c=0; c<nComp; ++c)
227  out << (pData[c] ? pData[c][i] : (TT)-987654321) << ' ';
228  out << std::endl;
229  }
230 }
blockLoc i
Definition: read.cpp:79

Here is the caller graph for this function:

bool rocElement2SMF ( string  rtype,
string &  etype 
)

Definition at line 143 of file cgns2smf.C.

Referenced by PrintConn().

144  {
145  if (rtype == "t3")
146  etype = "f";
147  else if (rtype == "t6")
148  etype = "f6";
149  else if (rtype == "q4")
150  etype = "q";
151  else if (rtype == "q8")
152  etype = "f";
153  else if (rtype == "T4")
154  etype = "x";
155  else if (rtype == "T10")
156  etype = "x10";
157  else if (rtype == "H8")
158  etype = "H8";
159  else if (rtype == "B20")
160  etype = "B20";
161  else if (rtype == "P5")
162  etype = "P5";
163  else if (rtype == "W6")
164  etype = "W6";
165  else if (rtype == "P6")
166  etype = "P6";
167  else
168  {
169  etype = "UNKNOWN";
170  return false;
171  }
172  return true;
173  }

Here is the caller graph for this function: