248 std::vector<AttrInfo> attrs(nAttrs+1);
249 attrs[0].m_name =
"nc";
251 &(attrs[0].m_location), &(attrs[0].m_dataType),
252 &(attrs[0].m_numComp), &(attrs[0].m_units));
256 std::istringstream
sin(attrStr);
257 for (i=1; i<nAttrs+1; ++
i) {
258 sin >> attrs[
i].m_name;
260 &(attrs[i].m_location), &(attrs[i].m_dataType),
261 &(attrs[i].m_numComp), &(attrs[i].m_units));
266 out <<
"TITLE=\"" << wName <<
". Time: " << timeStr <<
".\"" << std::endl;
267 out <<
"VARIABLES= \"x\", \"y\", \"z\"";
273 std::vector<int> elemCentered;
275 std::vector<AttrInfo>::iterator p = attrs.begin();
277 while (p != attrs.end()) {
278 if ((*p).m_location !=
'n' ) {
283 if ((*p).m_numComp == 1) {
284 out <<
", \"" << (*p).m_name <<
'"';
288 for (x=1; x<=(*p).m_numComp; ++
x) {
289 out <<
", \"" << x <<
'-' << (*p).m_name <<
'"';
299 for (i=0; i<nPanes; ++
i) {
302 name = wName +
".conn";
304 if ( with_ghost) ngElems = 0;
305 if ( nElems-ngElems==0)
continue;
307 out <<
"ZONE T=\"" << std::setw(5) << std::setfill(
'0')
308 << paneIds[
i] <<
"\", ";
313 name = wName +
".nc";
315 if ( with_ghost) ghost=0;
323 const int* dims = NULL;
324 char elemType =
'\0';
326 std::vector<ConnInfo> connInfo(nConn);
327 if (nConn == 1 && strncmp(connNames,
":st", 3) == 0) {
330 name = wName +
'.' + connNames;
332 if ( with_ghost) ghost=0;
335 COM_get_array_const(name.c_str(), paneIds[
i], &dims);
337 out <<
"I=" << dims[0] - 2 * ghost;
338 if ( ndims>=2) out <<
", J=" << dims[1] - 2 * ghost;
339 if ( ndims>=3) out <<
", K=" << dims[2] - 2 * ghost;
341 out <<
", ZONETYPE=ORDERED, ";
344 std::istringstream
sin(connNames);
345 std::vector<ConnInfo>::iterator c;
346 for (c=connInfo.begin(); c!=connInfo.end(); ++c) {
348 (*c).m_name = wName +
'.' + (*c).m_type;
349 (*c).m_type.erase(0, 1);
350 std::string::size_type
x = (*c).m_type.find(
':', 2);
351 if (x != std::string::npos)
352 (*c).m_type.erase(x);
354 COM_get_size((*c).m_name.c_str(), paneIds[
i], &((*c).m_numElements),
356 if ( with_ghost) (*c).m_numGhost = 0;
357 eTotal += (*c).m_numElements - (*c).m_numGhost;
361 if (elemType ==
'\0' || elemType ==
't'
362 || ((elemType ==
'q' || elemType ==
'T')
363 && (*c).m_type[0] >
'A' && (*c).m_type[0] <
'Z')
364 || (*c).m_type[0] ==
'B' || (*c).m_type[0] ==
'H')
365 elemType = (*c).m_type[0];
367 out <<
"N=" << nNodes - ghost <<
", E=" << eTotal <<
", ZONETYPE=";
370 out <<
"FETRIANGLE, ";
374 out <<
"FEQUADRILATERAL, ";
378 out <<
"FETETRAHEDRON, ";
396 out <<
"DATAPACKING=BLOCK";
397 if (!elemCentered.empty()) {
398 std::vector<int>::iterator cv = elemCentered.begin();
399 out <<
", VARLOCATION=([" << *cv;
401 while (cv != elemCentered.end()) {
405 out <<
"]=CELLCENTERED)";
409 for (p=attrs.begin(); p!=attrs.end(); ++p) {
410 const void* pArray = NULL;
411 if ((*p).m_numComp == 1) {
412 out <<
"# Begin " << (*p).m_name << std::endl;
413 COM_get_array_const((wName +
'.' + (*p).m_name).c_str(), paneIds[
i],
418 (*p).m_location, out));
422 ((*p).m_location !=
'n' ? eTotal
424 (*p).m_location ==
'p', out));
428 for (comp=1; comp<=(*p).m_numComp; ++comp) {
429 std::ostringstream sout;
430 sout << wName <<
'.' << comp <<
'-' << (*p).m_name;
431 out <<
"# Begin " << comp <<
'-' << (*p).m_name << std::endl;
432 COM_get_array_const(sout.str().c_str(), paneIds[
i], &pArray);
436 (*p).m_location, out));
440 ((*p).m_location !=
'n' ? eTotal
442 (*p).m_location ==
'p', out));
448 if (!connInfo.empty()) {
449 std::vector<ConnInfo>::iterator c = connInfo.begin();
450 while (c != connInfo.end()) {
451 const int* pConn = NULL;
452 COM_get_array_const((*c).m_name.c_str(), paneIds[
i], &pConn);
461 int n;
COM_get_size( (wName+
".ridges").c_str(), paneIds[i], &n);
464 out <<
"ZONE T=\"fea" << std::setw(5) << std::setfill(
'0')
465 << paneIds[
i] <<
"\", N=" << nNodes - ghost
466 <<
", E=" << n <<
", ZONETYPE=FELINESEG, DATAPACKING=BLOCK\n";
467 out <<
"VARSHARELIST=([1-" << var <<
"]=" << zone_count <<
")" << std::endl;
470 COM_get_array( (wName+
".ridges").c_str(), paneIds[i], &pArray);
472 for (
int i=0; i<
n; ++
i) {
473 out <<
" " << pArray[
i] <<
" " << pArray[i+
n] << std::endl;
void PrintConn(const int *pConn, const ConnInfo &ci, std::ostream &out)
void COM_get_attribute(const std::string wa_str, char *loc, int *type, int *ncomp, std::string *unit)
void PrintUnstructured(const TT **pData, int nComp, int size, std::ostream &out)
void PrintStructured(const TT **pData, int nComp, int ndims, const int *dims_nodes, int ghost, char loc, std::ostream &out)
void COM_get_array(const char *wa_str, int pane_id, void **addr, int *strd, int *cap)
Get the address for an attribute on a specific pane.
int COM_get_attribute_handle(const char *waname)
void COM_get_connectivities(const char *wname, int pane_id, int *nc, std::string &names)
void COM_get_attributes(const char *wname, int *na, std::string &names)
void COM_get_size(const char *wa_str, int pane_id, int *size, int *ng=0)
Get the sizes of an attribute.
#define SwitchOnDataType(dType, funcCall)
void COM_get_panes(const char *wname, std::vector< int > &pane_ids, int rank=-2)
void COM_free_buffer(int **buf)
std::vector< int > paneIds
Array of paneIds.