MCPcopy Create free account
hub / github.com/OpenSees/OpenSees / writeMesh

Method writeMesh

SRC/recorder/VTKHDF_Recorder.cpp:1432–2015  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1430
1431
1432int VTKHDF_Recorder::writeMesh() {
1433 // 1) Check domain
1434 if (theDomain == nullptr) {
1435 opserr << "WARNING: No domain found -- VTKHDF_Recorder::writeMesh\n";
1436 return -1;
1437 }
1438
1439 // Clear old data structures (if you store them as class members)
1440 theNodeMapping.clear();
1441 theEleMapping.clear();
1442 theNodeTags.clear();
1443 theEleTags.clear();
1444 theEleClassTags.clear();
1445 theEleVtkTags.clear();
1446 theEleVtkOffsets.clear();
1447
1448 // 2) Gather node info
1449 NodeIter &theNodes = theDomain->getNodes();
1450 Node *theNode;
1451 numNode = 0;
1452 maxNDM = 0; // max spatial dimension
1453 maxNDF = 0; // max degrees of freedom
1454
1455 while ((theNode = theNodes()) != nullptr) {
1456 int nodeTag = theNode->getTag();
1457
1458 const Vector &crd = theNode->getCrds();
1459 if (crd.Size() > maxNDM) {
1460 maxNDM = crd.Size();
1461 }
1462
1463 const Vector &disp = theNode->getTrialDisp();
1464 if (disp.Size() > maxNDF) {
1465 maxNDF = disp.Size();
1466 }
1467
1468 // Build mapping (nodeTag -> index)
1469 theNodeMapping[nodeTag] = numNode;
1470 theNodeTags.push_back(nodeTag);
1471 numNode++;
1472 }
1473
1474 // 3) Gather element info
1475 ElementIter &theElements = theDomain->getElements();
1476 Element *theElement;
1477 numElement = 0;
1478 numConnectivityIds = 0;
1479
1480 theEleVtkOffsets.push_back(numConnectivityIds);
1481 while ((theElement = theElements()) != nullptr) {
1482 int eleTag = theElement->getTag();
1483 int classTag = theElement->getClassTag();
1484
1485 // Check if recognized by our VTK type map
1486 auto it = vtktypes.find(classTag);
1487 if (it != vtktypes.end()) {
1488 int vtkType = it->second;
1489

Callers 2

recordMethod · 0.95
domainChangedMethod · 0.95

Calls 13

getNodesMethod · 0.80
getCrdsMethod · 0.80
push_backMethod · 0.80
clearMethod · 0.45
getTagMethod · 0.45
SizeMethod · 0.45
getElementsMethod · 0.45
getClassTagMethod · 0.45
endMethod · 0.45
beginMethod · 0.45
dataMethod · 0.45
getElementMethod · 0.45

Tested by

no test coverage detected