Nektar++
Loading...
Searching...
No Matches
MeshGraphIOXmlCompressed.cpp
Go to the documentation of this file.
1////////////////////////////////////////////////////////////////////////////////
2//
3// File: MeshGraphIOXmlCompressed.cpp
4//
5// For more information, please see: http://www.nektar.info/
6//
7// The MIT License
8//
9// Copyright (c) 2006 Division of Applied Mathematics, Brown University (USA),
10// Department of Aeronautics, Imperial College London (UK), and Scientific
11// Computing and Imaging Institute, University of Utah (USA).
12//
13// Permission is hereby granted, free of charge, to any person obtaining a
14// copy of this software and associated documentation files (the "Software"),
15// to deal in the Software without restriction, including without limitation
16// the rights to use, copy, modify, merge, publish, distribute, sublicense,
17// and/or sell copies of the Software, and to permit persons to whom the
18// Software is furnished to do so, subject to the following conditions:
19//
20// The above copyright notice and this permission notice shall be included
21// in all copies or substantial portions of the Software.
22//
23// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
24// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
26// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29// DEALINGS IN THE SOFTWARE.
30//
31// Description:
32//
33//
34////////////////////////////////////////////////////////////////////////////////
35
37
41
44
45// These are required for the Write(...) and Import(...) functions.
46#include <boost/algorithm/string/predicate.hpp>
47#include <boost/archive/iterators/base64_from_binary.hpp>
48#include <boost/archive/iterators/binary_from_base64.hpp>
49#include <boost/archive/iterators/transform_width.hpp>
50#include <boost/format.hpp>
51
52#include <tinyxml.h>
53
55{
56
59 "XmlCompressed", MeshGraphIOXmlCompressed::create,
60 "IO with compressed Xml geometry");
61
63{
64 int spaceDimension = m_meshGraph->GetSpaceDimension();
65
66 // Now read the vertices
67 TiXmlElement *element = m_xmlGeom->FirstChildElement("VERTEX");
68 ASSERTL0(element, "Unable to find mesh VERTEX tag in file.");
69
70 NekDouble xscale, yscale, zscale;
71
72 // check to see if any scaling parameters are in
73 // attributes and determine these values
74 LibUtilities::Interpreter expEvaluator;
75 const char *xscal = element->Attribute("XSCALE");
76 if (!xscal)
77 {
78 xscale = 1.0;
79 }
80 else
81 {
82 std::string xscalstr = xscal;
83 int expr_id = expEvaluator.DefineFunction("", xscalstr);
84 xscale = expEvaluator.Evaluate(expr_id);
85 }
86
87 const char *yscal = element->Attribute("YSCALE");
88 if (!yscal)
89 {
90 yscale = 1.0;
91 }
92 else
93 {
94 std::string yscalstr = yscal;
95 int expr_id = expEvaluator.DefineFunction("", yscalstr);
96 yscale = expEvaluator.Evaluate(expr_id);
97 }
98
99 const char *zscal = element->Attribute("ZSCALE");
100 if (!zscal)
101 {
102 zscale = 1.0;
103 }
104 else
105 {
106 std::string zscalstr = zscal;
107 int expr_id = expEvaluator.DefineFunction("", zscalstr);
108 zscale = expEvaluator.Evaluate(expr_id);
109 }
110
111 NekDouble xmove, ymove, zmove;
112
113 // check to see if any moving parameters are in
114 // attributes and determine these values
115
116 const char *xmov = element->Attribute("XMOVE");
117 if (!xmov)
118 {
119 xmove = 0.0;
120 }
121 else
122 {
123 std::string xmovstr = xmov;
124 int expr_id = expEvaluator.DefineFunction("", xmovstr);
125 xmove = expEvaluator.Evaluate(expr_id);
126 }
127
128 const char *ymov = element->Attribute("YMOVE");
129 if (!ymov)
130 {
131 ymove = 0.0;
132 }
133 else
134 {
135 std::string ymovstr = ymov;
136 int expr_id = expEvaluator.DefineFunction("", ymovstr);
137 ymove = expEvaluator.Evaluate(expr_id);
138 }
139
140 const char *zmov = element->Attribute("ZMOVE");
141 if (!zmov)
142 {
143 zmove = 0.0;
144 }
145 else
146 {
147 std::string zmovstr = zmov;
148 int expr_id = expEvaluator.DefineFunction("", zmovstr);
149 zmove = expEvaluator.Evaluate(expr_id);
150 }
151
152 NekDouble zrotate;
153
154 const char *zrot = element->Attribute("ZROT");
155 if (!zrot)
156 {
157 zrotate = 0.0;
158 }
159 else
160 {
161 std::string zrotstr = zrot;
162 int expr_id = expEvaluator.DefineFunction("", zrotstr);
163 zrotate = expEvaluator.Evaluate(expr_id);
164 }
165
166 std::string IsCompressed;
167 element->QueryStringAttribute("COMPRESSED", &IsCompressed);
168
169 if (boost::iequals(IsCompressed,
171 {
172 // Extract the vertex body
173 TiXmlNode *vertexChild = element->FirstChild();
174 ASSERTL0(vertexChild, "Unable to extract the data from the compressed "
175 "vertex tag.");
176
177 std::string vertexStr;
178 if (vertexChild->Type() == TiXmlNode::TINYXML_TEXT)
179 {
180 vertexStr += vertexChild->ToText()->ValueStr();
181 }
182
183 std::vector<SpatialDomains::MeshVertex> vertData;
185 vertData);
186
187 int indx;
188 NekDouble xval, yval, zval;
189 for (int i = 0; i < vertData.size(); ++i)
190 {
191 indx = vertData[i].id;
192 xval = vertData[i].x;
193 yval = vertData[i].y;
194 zval = vertData[i].z;
195
196 xval = xval * xscale + xmove;
197 yval = yval * yscale + ymove;
198 zval = zval * zscale + zmove;
199
200 if (zrotate != 0.0)
201 {
202 NekDouble xval_tmp = xval * cos(zrotate) - yval * sin(zrotate);
203 yval = xval * sin(zrotate) + yval * cos(zrotate);
204 xval = xval_tmp;
205 }
206
207 m_meshGraph->CreatePointGeom(spaceDimension, indx, xval, yval,
208 zval);
209 }
210 }
211 else
212 {
213 ASSERTL0(false, "Compressed formats do not match. Expected :" +
215 " but got " + IsCompressed);
216 }
217}
218
220{
221 auto &curvedEdges = m_meshGraph->GetCurvedEdges();
222 auto &curvedFaces = m_meshGraph->GetCurvedFaces();
223 auto &curveNodes = m_meshGraph->GetAllCurveNodes();
224 int spaceDimension = m_meshGraph->GetSpaceDimension();
225
226 // check to see if any scaling parameters are in
227 // attributes and determine these values
228 TiXmlElement *element = m_xmlGeom->FirstChildElement("VERTEX");
229 ASSERTL0(element, "Unable to find mesh VERTEX tag in file.");
230
231 NekDouble xscale, yscale, zscale;
232
233 LibUtilities::Interpreter expEvaluator;
234 const char *xscal = element->Attribute("XSCALE");
235 if (!xscal)
236 {
237 xscale = 1.0;
238 }
239 else
240 {
241 std::string xscalstr = xscal;
242 int expr_id = expEvaluator.DefineFunction("", xscalstr);
243 xscale = expEvaluator.Evaluate(expr_id);
244 }
245
246 const char *yscal = element->Attribute("YSCALE");
247 if (!yscal)
248 {
249 yscale = 1.0;
250 }
251 else
252 {
253 std::string yscalstr = yscal;
254 int expr_id = expEvaluator.DefineFunction("", yscalstr);
255 yscale = expEvaluator.Evaluate(expr_id);
256 }
257
258 const char *zscal = element->Attribute("ZSCALE");
259 if (!zscal)
260 {
261 zscale = 1.0;
262 }
263 else
264 {
265 std::string zscalstr = zscal;
266 int expr_id = expEvaluator.DefineFunction("", zscalstr);
267 zscale = expEvaluator.Evaluate(expr_id);
268 }
269
270 NekDouble xmove, ymove, zmove;
271
272 // check to see if any moving parameters are in
273 // attributes and determine these values
274
275 const char *xmov = element->Attribute("XMOVE");
276 if (!xmov)
277 {
278 xmove = 0.0;
279 }
280 else
281 {
282 std::string xmovstr = xmov;
283 int expr_id = expEvaluator.DefineFunction("", xmovstr);
284 xmove = expEvaluator.Evaluate(expr_id);
285 }
286
287 const char *ymov = element->Attribute("YMOVE");
288 if (!ymov)
289 {
290 ymove = 0.0;
291 }
292 else
293 {
294 std::string ymovstr = ymov;
295 int expr_id = expEvaluator.DefineFunction("", ymovstr);
296 ymove = expEvaluator.Evaluate(expr_id);
297 }
298
299 const char *zmov = element->Attribute("ZMOVE");
300 if (!zmov)
301 {
302 zmove = 0.0;
303 }
304 else
305 {
306 std::string zmovstr = zmov;
307 int expr_id = expEvaluator.DefineFunction("", zmovstr);
308 zmove = expEvaluator.Evaluate(expr_id);
309 }
310
311 NekDouble zrotate;
312
313 const char *zrot = element->Attribute("ZROT");
314 if (!zrot)
315 {
316 zrotate = 0.0;
317 }
318 else
319 {
320 std::string zrotstr = zrot;
321 int expr_id = expEvaluator.DefineFunction("", zrotstr);
322 zrotate = expEvaluator.Evaluate(expr_id);
323 }
324
325 /// Look for elements in CURVE block.
326 TiXmlElement *field = m_xmlGeom->FirstChildElement("CURVED");
327
328 if (!field) // return if no curved entities
329 {
330 return;
331 }
332
333 std::string IsCompressed;
334 field->QueryStringAttribute("COMPRESSED", &IsCompressed);
335
336 if (IsCompressed.size() == 0)
337 {
338 // this could be that the curved tag is empty
339 // in this case we dont want to read it
340 return;
341 }
342
343 ASSERTL0(boost::iequals(IsCompressed,
345 "Compressed formats do not match. Expected :" +
347 IsCompressed);
348
349 std::vector<SpatialDomains::MeshCurvedInfo> edginfo;
350 std::vector<SpatialDomains::MeshCurvedInfo> facinfo;
352
353 // read edge, face info and curved poitns.
354 TiXmlElement *x = field->FirstChildElement();
355 while (x)
356 {
357 const char *entitytype = x->Value();
358 // read in edge or face info
359 if (boost::iequals(entitytype, "E"))
360 {
361 // read in data
362 std::string elmtStr;
363 TiXmlNode *child = x->FirstChild();
364
365 if (child->Type() == TiXmlNode::TINYXML_TEXT)
366 {
367 elmtStr += child->ToText()->ValueStr();
368 }
369
371 edginfo);
372 }
373 else if (boost::iequals(entitytype, "F"))
374 {
375 // read in data
376 std::string elmtStr;
377 TiXmlNode *child = x->FirstChild();
378
379 if (child->Type() == TiXmlNode::TINYXML_TEXT)
380 {
381 elmtStr += child->ToText()->ValueStr();
382 }
383
385 facinfo);
386 }
387 else if (boost::iequals(entitytype, "DATAPOINTS"))
388 {
389 int32_t id;
390 ASSERTL0(x->Attribute("ID", &id),
391 "Failed to get ID from PTS section");
392 cpts.id = id;
393
394 // read in data
395 std::string elmtStr;
396
397 TiXmlElement *DataIdx = x->FirstChildElement("INDEX");
398 ASSERTL0(DataIdx, "Cannot read data index tag in compressed "
399 "curved section");
400
401 TiXmlNode *child = DataIdx->FirstChild();
402 if (child->Type() == TiXmlNode::TINYXML_TEXT)
403 {
404 elmtStr = child->ToText()->ValueStr();
405 }
406
408 cpts.index);
409
410 TiXmlElement *DataPts = x->FirstChildElement("POINTS");
411 ASSERTL0(DataPts, "Cannot read data pts tag in compressed "
412 "curved section");
413
414 child = DataPts->FirstChild();
415 if (child->Type() == TiXmlNode::TINYXML_TEXT)
416 {
417 elmtStr = child->ToText()->ValueStr();
418 }
419
421 cpts.pts);
422 }
423 else
424 {
425 ASSERTL0(false, "Unknown tag in curved section");
426 }
427 x = x->NextSiblingElement();
428 }
429
430 // rescale (x,y,z) points;
431 for (int i = 0; i < cpts.pts.size(); ++i)
432 {
433 cpts.pts[i].x = xscale * cpts.pts[i].x + xmove;
434 cpts.pts[i].y = yscale * cpts.pts[i].y + ymove;
435 cpts.pts[i].z = zscale * cpts.pts[i].z + zmove;
436
437 if (zrotate != 0.0)
438 {
439 NekDouble xval_tmp =
440 cpts.pts[i].x * cos(zrotate) - cpts.pts[i].y * sin(zrotate);
441 cpts.pts[i].y =
442 cpts.pts[i].x * sin(zrotate) + cpts.pts[i].y * cos(zrotate);
443 cpts.pts[i].x = xval_tmp;
444 }
445 }
446
447 for (int i = 0; i < edginfo.size(); ++i)
448 {
449 int edgeid = edginfo[i].entityid;
451
452 curvedEdges[edgeid] = ObjPoolManager<Curve>::AllocateUniquePtr(
453 edgeid, ptype = (LibUtilities::PointsType)edginfo[i].ptype);
454
455 // load points
456 int offset = edginfo[i].ptoffset;
457 for (int j = 0; j < edginfo[i].npoints; ++j)
458 {
459 int idx = cpts.index[offset + j];
460 curveNodes.emplace_back(
462 spaceDimension, edginfo[i].id, cpts.pts[idx].x,
463 cpts.pts[idx].y, cpts.pts[idx].z));
464 curvedEdges[edgeid]->m_points.emplace_back(curveNodes.back().get());
465 }
466 }
467
468 for (int i = 0; i < facinfo.size(); ++i)
469 {
470 int faceid = facinfo[i].entityid;
472
473 curvedFaces[faceid] = ObjPoolManager<Curve>::AllocateUniquePtr(
474 faceid, ptype = (LibUtilities::PointsType)facinfo[i].ptype);
475
476 int offset = facinfo[i].ptoffset;
477 for (int j = 0; j < facinfo[i].npoints; ++j)
478 {
479 int idx = cpts.index[offset + j];
480 curveNodes.emplace_back(
482 spaceDimension, facinfo[i].id, cpts.pts[idx].x,
483 cpts.pts[idx].y, cpts.pts[idx].z));
484 curvedFaces[faceid]->m_points.emplace_back(curveNodes.back().get());
485 }
486 }
487}
488
490{
491 auto &curvedEdges = m_meshGraph->GetCurvedEdges();
492 int spaceDimension = m_meshGraph->GetSpaceDimension();
493
494 CurveMap::iterator it;
495
496 /// Look for elements in ELEMENT block.
497 TiXmlElement *field = m_xmlGeom->FirstChildElement("EDGE");
498
499 ASSERTL0(field, "Unable to find EDGE tag in file.");
500
501 std::string IsCompressed;
502 field->QueryStringAttribute("COMPRESSED", &IsCompressed);
503
504 ASSERTL0(boost::iequals(IsCompressed,
506 "Compressed formats do not match. Expected :" +
508 IsCompressed);
509 // Extract the edge body
510 TiXmlNode *edgeChild = field->FirstChild();
511 ASSERTL0(edgeChild, "Unable to extract the data from "
512 "the compressed edge tag.");
513
514 std::string edgeStr;
515 if (edgeChild->Type() == TiXmlNode::TINYXML_TEXT)
516 {
517 edgeStr += edgeChild->ToText()->ValueStr();
518 }
519
520 std::vector<SpatialDomains::MeshEdge> edgeData;
522
523 int indx;
524 for (int i = 0; i < edgeData.size(); ++i)
525 {
526 indx = edgeData[i].id;
527 std::array<PointGeom *, 2> vertices = {
528 m_meshGraph->GetPointGeom(edgeData[i].v0),
529 m_meshGraph->GetPointGeom(edgeData[i].v1)};
530 SegGeomUniquePtr edge;
531 it = curvedEdges.find(indx);
532 if (it == curvedEdges.end())
533 {
534 m_meshGraph->AddGeom(indx,
536 indx, spaceDimension, vertices));
537 }
538 else
539 {
540 m_meshGraph->AddGeom(
542 indx, spaceDimension, vertices, it->second.get()));
543 }
544 }
545}
546
548{
549 auto &curvedFaces = m_meshGraph->GetCurvedFaces();
550
551 /// Look for elements in FACE block.
552 TiXmlElement *field = m_xmlGeom->FirstChildElement("FACE");
553
554 ASSERTL0(field, "Unable to find FACE tag in file.");
555
556 /// All faces are of the form: "<? ID="#"> ... </?>", with
557 /// ? being an element type (either Q or T).
558 /// They might be in compressed format and so then need upacking.
559
560 TiXmlElement *element = field->FirstChildElement();
561 CurveMap::iterator it;
562
563 while (element)
564 {
565 std::string elementType(element->ValueStr());
566
567 ASSERTL0(elementType == "Q" || elementType == "T",
568 (std::string("Unknown 3D face type: ") + elementType).c_str());
569
570 std::string IsCompressed;
571 element->QueryStringAttribute("COMPRESSED", &IsCompressed);
572
573 ASSERTL0(
574 boost::iequals(IsCompressed,
576 "Compressed formats do not match. Expected :" +
578 IsCompressed);
579
580 // Extract the face body
581 TiXmlNode *faceChild = element->FirstChild();
582 ASSERTL0(faceChild, "Unable to extract the data from "
583 "the compressed face tag.");
584
585 std::string faceStr;
586 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
587 {
588 faceStr += faceChild->ToText()->ValueStr();
589 }
590
591 int indx;
592 if (elementType == "T")
593 {
594 std::vector<SpatialDomains::MeshTri> faceData;
596 faceData);
597
598 for (int i = 0; i < faceData.size(); ++i)
599 {
600 indx = faceData[i].id;
601
602 /// See if this face has curves.
603 it = curvedFaces.find(indx);
604
605 /// Create a TriGeom to hold the new definition.
606 std::array<SegGeom *, TriGeom::kNedges> edges = {
607 m_meshGraph->GetSegGeom(faceData[i].e[0]),
608 m_meshGraph->GetSegGeom(faceData[i].e[1]),
609 m_meshGraph->GetSegGeom(faceData[i].e[2])};
610
611 if (it == curvedFaces.end())
612 {
613 m_meshGraph->AddGeom(
615 indx, edges));
616 }
617 else
618 {
619 m_meshGraph->AddGeom(
621 indx, edges, it->second.get()));
622 }
623 }
624 }
625 else if (elementType == "Q")
626 {
627 std::vector<SpatialDomains::MeshQuad> faceData;
629 faceData);
630
631 for (int i = 0; i < faceData.size(); ++i)
632 {
633 indx = faceData[i].id;
634
635 /// See if this face has curves.
636 it = curvedFaces.find(indx);
637
638 /// Create a QuadGeom to hold the new definition.
639 std::array<SegGeom *, QuadGeom::kNedges> edges = {
640 m_meshGraph->GetSegGeom(faceData[i].e[0]),
641 m_meshGraph->GetSegGeom(faceData[i].e[1]),
642 m_meshGraph->GetSegGeom(faceData[i].e[2]),
643 m_meshGraph->GetSegGeom(faceData[i].e[3])};
644
645 if (it == curvedFaces.end())
646 {
647 m_meshGraph->AddGeom(
649 indx, edges));
650 }
651 else
652 {
653 m_meshGraph->AddGeom(
655 indx, edges, it->second.get()));
656 }
657 }
658 }
659 /// Keep looking
660 element = element->NextSiblingElement();
661 }
662}
663
665{
666 auto &curvedEdges = m_meshGraph->GetCurvedEdges();
667 int spaceDimension = m_meshGraph->GetSpaceDimension();
668
669 TiXmlElement *field = nullptr;
670
671 /// Look for elements in ELEMENT block.
672 field = m_xmlGeom->FirstChildElement("ELEMENT");
673
674 ASSERTL0(field, "Unable to find ELEMENT tag in file.");
675
676 /// All elements are of the form: "<S ID = n> ... </S>", with
677 /// ? being the element type.
678
679 TiXmlElement *segment = field->FirstChildElement("S");
680 CurveMap::iterator it;
681
682 while (segment)
683 {
684 std::string IsCompressed;
685 segment->QueryStringAttribute("COMPRESSED", &IsCompressed);
686 ASSERTL0(
687 boost::iequals(IsCompressed,
689 "Compressed formats do not match. Expected :" +
691 IsCompressed);
692
693 // Extract the face body
694 TiXmlNode *child = segment->FirstChild();
695 ASSERTL0(child, "Unable to extract the data from "
696 "the compressed face tag.");
697
698 std::string str;
699 if (child->Type() == TiXmlNode::TINYXML_TEXT)
700 {
701 str += child->ToText()->ValueStr();
702 }
703
704 int indx;
705
706 std::vector<SpatialDomains::MeshEdge> data;
708
709 for (int i = 0; i < data.size(); ++i)
710 {
711 indx = data[i].id;
712
713 /// See if this face has curves.
714 it = curvedEdges.find(indx);
715
716 std::array<PointGeom *, 2> vertices = {
717 m_meshGraph->GetPointGeom(data[i].v0),
718 m_meshGraph->GetPointGeom(data[i].v1)};
720
721 if (it == curvedEdges.end())
722 {
723 m_meshGraph->AddGeom(indx,
725 indx, spaceDimension, vertices));
726 }
727 else
728 {
729 m_meshGraph->AddGeom(
730 indx,
732 indx, spaceDimension, vertices, it->second.get()));
733 }
734 }
735 /// Keep looking for additional segments
736 segment = segment->NextSiblingElement("S");
737 }
738}
739
741{
742 auto &curvedFaces = m_meshGraph->GetCurvedFaces();
743
744 /// Look for elements in ELEMENT block.
745 TiXmlElement *field = m_xmlGeom->FirstChildElement("ELEMENT");
746
747 ASSERTL0(field, "Unable to find ELEMENT tag in file.");
748
749 // Set up curve map for curved elements on an embedded manifold.
750 CurveMap::iterator it;
751
752 /// All elements are of the form: "<? ID="#"> ... </?>", with
753 /// ? being the element type.
754
755 TiXmlElement *element = field->FirstChildElement();
756
757 while (element)
758 {
759 std::string elementType(element->ValueStr());
760
761 ASSERTL0(
762 elementType == "Q" || elementType == "T",
763 (std::string("Unknown 2D element type: ") + elementType).c_str());
764
765 std::string IsCompressed;
766 element->QueryStringAttribute("COMPRESSED", &IsCompressed);
767
768 ASSERTL0(
769 boost::iequals(IsCompressed,
771 "Compressed formats do not match. Expected :" +
773 IsCompressed);
774
775 // Extract the face body
776 TiXmlNode *faceChild = element->FirstChild();
777 ASSERTL0(faceChild, "Unable to extract the data from "
778 "the compressed face tag.");
779
780 std::string faceStr;
781 if (faceChild->Type() == TiXmlNode::TINYXML_TEXT)
782 {
783 faceStr += faceChild->ToText()->ValueStr();
784 }
785
786 int indx;
787 if (elementType == "T")
788 {
789 std::vector<SpatialDomains::MeshTri> faceData;
791 faceData);
792
793 for (int i = 0; i < faceData.size(); ++i)
794 {
795 indx = faceData[i].id;
796
797 /// See if this face has curves.
798 it = curvedFaces.find(indx);
799
800 /// Create a TriGeom to hold the new definition.
801 std::array<SegGeom *, TriGeom::kNedges> edges = {
802 m_meshGraph->GetSegGeom(faceData[i].e[0]),
803 m_meshGraph->GetSegGeom(faceData[i].e[1]),
804 m_meshGraph->GetSegGeom(faceData[i].e[2])};
805
806 if (it == curvedFaces.end())
807 {
808 m_meshGraph->AddGeom(
810 indx, edges));
811 }
812 else
813 {
814 m_meshGraph->AddGeom(
816 indx, edges, it->second.get()));
817 }
818 }
819 }
820 else if (elementType == "Q")
821 {
822 std::vector<SpatialDomains::MeshQuad> faceData;
824 faceData);
825
826 for (int i = 0; i < faceData.size(); ++i)
827 {
828 indx = faceData[i].id;
829
830 /// See if this face has curves.
831 it = curvedFaces.find(indx);
832
833 /// Create a QuadGeom to hold the new definition.
834 std::array<SegGeom *, QuadGeom::kNedges> edges = {
835 m_meshGraph->GetSegGeom(faceData[i].e[0]),
836 m_meshGraph->GetSegGeom(faceData[i].e[1]),
837 m_meshGraph->GetSegGeom(faceData[i].e[2]),
838 m_meshGraph->GetSegGeom(faceData[i].e[3])};
839
840 if (it == curvedFaces.end())
841 {
842 m_meshGraph->AddGeom(
844 indx, edges));
845 }
846 else
847 {
848 m_meshGraph->AddGeom(
850 indx, edges, it->second.get()));
851 }
852 }
853 }
854 /// Keep looking
855 element = element->NextSiblingElement();
856 }
857}
858
860{
861 /// Look for elements in ELEMENT block.
862 TiXmlElement *field = m_xmlGeom->FirstChildElement("ELEMENT");
863
864 ASSERTL0(field, "Unable to find ELEMENT tag in file.");
865
866 /// All elements are of the form: "<? ID="#"> ... </?>", with
867 /// ? being the element type.
868
869 TiXmlElement *element = field->FirstChildElement();
870
871 while (element)
872 {
873 std::string elementType(element->ValueStr());
874
875 // A - tet, P - pyramid, R - prism, H - hex
876 ASSERTL0(
877 elementType == "A" || elementType == "P" || elementType == "R" ||
878 elementType == "H",
879 (std::string("Unknown 3D element type: ") + elementType).c_str());
880
881 std::string IsCompressed;
882 element->QueryStringAttribute("COMPRESSED", &IsCompressed);
883
884 ASSERTL0(
885 boost::iequals(IsCompressed,
887 "Compressed formats do not match. Expected :" +
889 IsCompressed);
890
891 // Extract the face body
892 TiXmlNode *child = element->FirstChild();
893 ASSERTL0(child, "Unable to extract the data from "
894 "the compressed face tag.");
895
896 std::string str;
897 if (child->Type() == TiXmlNode::TINYXML_TEXT)
898 {
899 str += child->ToText()->ValueStr();
900 }
901
902 int indx;
903 if (elementType == "A")
904 {
905 std::vector<SpatialDomains::MeshTet> data;
907 std::array<TriGeom *, 4> tfaces;
908 for (int i = 0; i < data.size(); ++i)
909 {
910 indx = data[i].id;
911 for (int j = 0; j < 4; ++j)
912 {
913 Geometry2D *face = m_meshGraph->GetGeometry2D(data[i].f[j]);
914 tfaces[j] = static_cast<TriGeom *>(face);
915 }
916
917 auto tetGeom =
919 m_meshGraph->PopulateFaceToElMap(tetGeom.get(), 4);
920 m_meshGraph->AddGeom(indx, std::move(tetGeom));
921 }
922 }
923 else if (elementType == "P")
924 {
925 std::vector<SpatialDomains::MeshPyr> data;
927 std::array<Geometry2D *, 5> faces;
928 for (int i = 0; i < data.size(); ++i)
929 {
930 indx = data[i].id;
931 int Ntfaces = 0;
932 int Nqfaces = 0;
933 for (int j = 0; j < 5; ++j)
934 {
935 Geometry2D *face = m_meshGraph->GetGeometry2D(data[i].f[j]);
936
937 if (face == nullptr ||
940 {
941 std::stringstream errorstring;
942 errorstring << "Element " << indx
943 << " has invalid face: " << j;
944 ASSERTL0(false, errorstring.str().c_str());
945 }
946 else if (face->GetShapeType() == LibUtilities::eTriangle)
947 {
948 faces[j] = static_cast<TriGeom *>(face);
949 Ntfaces++;
950 }
951 else if (face->GetShapeType() ==
953 {
954 faces[j] = static_cast<QuadGeom *>(face);
955 Nqfaces++;
956 }
957 }
958 ASSERTL0((Ntfaces == 4) && (Nqfaces == 1),
959 "Did not identify the correct number of "
960 "triangular and quadrilateral faces for a "
961 "pyramid");
962
963 auto pyrGeom =
965 m_meshGraph->PopulateFaceToElMap(pyrGeom.get(), 5);
966 m_meshGraph->AddGeom(indx, std::move(pyrGeom));
967 }
968 }
969 else if (elementType == "R")
970 {
971 std::vector<SpatialDomains::MeshPrism> data;
973 std::array<Geometry2D *, 5> faces;
974 for (int i = 0; i < data.size(); ++i)
975 {
976 indx = data[i].id;
977 int Ntfaces = 0;
978 int Nqfaces = 0;
979 for (int j = 0; j < 5; ++j)
980 {
981 Geometry2D *face = m_meshGraph->GetGeometry2D(data[i].f[j]);
982 if (face == nullptr ||
985 {
986 std::stringstream errorstring;
987 errorstring << "Element " << indx
988 << " has invalid face: " << j;
989 ASSERTL0(false, errorstring.str().c_str());
990 }
991 else if (face->GetShapeType() == LibUtilities::eTriangle)
992 {
993 faces[j] = static_cast<TriGeom *>(face);
994 Ntfaces++;
995 }
996 else if (face->GetShapeType() ==
998 {
999 faces[j] = static_cast<QuadGeom *>(face);
1000 Nqfaces++;
1001 }
1002 }
1003 ASSERTL0((Ntfaces == 2) && (Nqfaces == 3),
1004 "Did not identify the correct number of "
1005 "triangular and quadrilateral faces for a "
1006 "prism");
1007
1008 auto prismGeom =
1010 m_meshGraph->PopulateFaceToElMap(prismGeom.get(), 5);
1011 m_meshGraph->AddGeom(indx, std::move(prismGeom));
1012 }
1013 }
1014 else if (elementType == "H")
1015 {
1016 std::vector<SpatialDomains::MeshHex> data;
1018
1019 std::array<QuadGeom *, 6> faces;
1020 for (int i = 0; i < data.size(); ++i)
1021 {
1022 indx = data[i].id;
1023 for (int j = 0; j < 6; ++j)
1024 {
1025 Geometry2D *face = m_meshGraph->GetGeometry2D(data[i].f[j]);
1026 faces[j] = static_cast<QuadGeom *>(face);
1027 }
1028
1029 auto hexGeom =
1031 m_meshGraph->PopulateFaceToElMap(hexGeom.get(), 6);
1032 m_meshGraph->AddGeom(indx, std::move(hexGeom));
1033 }
1034 }
1035 /// Keep looking
1036 element = element->NextSiblingElement();
1037 }
1038}
1039
1040void WriteVert(PointGeom *vert, std::vector<MeshVertex> &vertInfo, int vertID)
1041{
1042 MeshVertex v;
1043 v.id = vertID;
1044 v.x = vert->x();
1045 v.y = vert->y();
1046 v.z = vert->z();
1047 vertInfo.push_back(v);
1048}
1050 std::vector<int> keysToWrite)
1051{
1052 auto &verts = m_meshGraph->GetGeomMap<PointGeom>();
1053 if (m_meshGraph->GetGeomMap<PointGeom>().size() == 0)
1054 {
1055 return;
1056 }
1057
1058 TiXmlElement *vertTag = new TiXmlElement("VERTEX");
1059
1060 std::vector<MeshVertex> vertInfo;
1061
1062 if (keysToWrite.empty())
1063 {
1064 for (auto [id, vert] : verts)
1065 {
1066 WriteVert(vert, vertInfo, id);
1067 }
1068 }
1069 else
1070 {
1071 for (int id : keysToWrite)
1072 {
1073 WriteVert(verts.at(id), vertInfo, id);
1074 }
1075 }
1076
1077 vertTag->SetAttribute("COMPRESSED",
1079 vertTag->SetAttribute("BITSIZE",
1081
1082 std::string vertStr;
1084
1085 vertTag->LinkEndChild(new TiXmlText(vertStr));
1086
1087 geomTag->LinkEndChild(vertTag);
1088}
1089
1090void WriteEdge(SegGeom *seg, std::vector<MeshEdge> &edgeInfo, int edgeID)
1091{
1092 MeshEdge e;
1093 e.id = edgeID;
1094 e.v0 = seg->GetVid(0);
1095 e.v1 = seg->GetVid(1);
1096 edgeInfo.push_back(e);
1097}
1099 std::vector<int> keysToWrite)
1100{
1101 auto &edges = m_meshGraph->GetGeomMap<SegGeom>();
1102 if (m_meshGraph->GetGeomMap<SegGeom>().size() == 0)
1103 {
1104 return;
1105 }
1106
1107 int meshDimension = m_meshGraph->GetMeshDimension();
1108
1109 TiXmlElement *edgeTag = new TiXmlElement(meshDimension == 1 ? "S" : "EDGE");
1110
1111 std::vector<MeshEdge> edgeInfo;
1112
1113 if (keysToWrite.empty())
1114 {
1115 for (auto [id, edge] : edges)
1116 {
1117 WriteEdge(edge, edgeInfo, id);
1118 }
1119 }
1120 else
1121 {
1122 for (int id : keysToWrite)
1123 {
1124 WriteEdge(edges.at(id), edgeInfo, id);
1125 }
1126 }
1127
1128 std::string edgeStr;
1130
1131 edgeTag->SetAttribute("COMPRESSED",
1133 edgeTag->SetAttribute("BITSIZE",
1135
1136 edgeTag->LinkEndChild(new TiXmlText(edgeStr));
1137
1138 if (meshDimension == 1)
1139 {
1140 TiXmlElement *tmp = new TiXmlElement("ELEMENT");
1141 tmp->LinkEndChild(edgeTag);
1142 geomTag->LinkEndChild(tmp);
1143 }
1144 else
1145 {
1146 geomTag->LinkEndChild(edgeTag);
1147 }
1148}
1149
1150void WriteTri(TriGeom *tri, std::vector<MeshTri> &triInfo, int triID)
1151{
1152 MeshTri t;
1153 t.id = triID;
1154 t.e[0] = tri->GetEid(0);
1155 t.e[1] = tri->GetEid(1);
1156 t.e[2] = tri->GetEid(2);
1157 triInfo.push_back(t);
1158}
1159void MeshGraphIOXmlCompressed::v_WriteTris(TiXmlElement *faceTag,
1160 std::vector<int> keysToWrite)
1161{
1162 auto &tris = m_meshGraph->GetGeomMap<TriGeom>();
1163
1164 if (tris.size() == 0)
1165 {
1166 return;
1167 }
1168
1169 std::string tag = "T";
1170
1171 std::vector<MeshTri> triInfo;
1172
1173 if (keysToWrite.empty())
1174 {
1175 for (auto [id, tri] : tris)
1176 {
1177 WriteTri(tri, triInfo, id);
1178 }
1179 }
1180 else
1181 {
1182 for (int id : keysToWrite)
1183 {
1184 WriteTri(tris.at(id), triInfo, id);
1185 }
1186 }
1187
1188 TiXmlElement *x = new TiXmlElement(tag);
1189 std::string triStr;
1191
1192 x->SetAttribute("COMPRESSED",
1194 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1195
1196 x->LinkEndChild(new TiXmlText(triStr));
1197
1198 faceTag->LinkEndChild(x);
1199}
1200
1201void WriteQuad(QuadGeom *quad, std::vector<MeshQuad> &quadInfo, int quadID)
1202{
1203 MeshQuad q;
1204 q.id = quadID;
1205 q.e[0] = quad->GetEid(0);
1206 q.e[1] = quad->GetEid(1);
1207 q.e[2] = quad->GetEid(2);
1208 q.e[3] = quad->GetEid(3);
1209 quadInfo.push_back(q);
1210}
1212 std::vector<int> keysToWrite)
1213{
1214 auto &quads = m_meshGraph->GetGeomMap<QuadGeom>();
1215
1216 if (quads.size() == 0)
1217 {
1218 return;
1219 }
1220
1221 std::string tag = "Q";
1222
1223 std::vector<MeshQuad> quadInfo;
1224
1225 if (keysToWrite.empty())
1226 {
1227 for (auto [id, quad] : quads)
1228 {
1229 WriteQuad(quad, quadInfo, id);
1230 }
1231 }
1232 else
1233 {
1234 for (int id : keysToWrite)
1235 {
1236 WriteQuad(quads.at(id), quadInfo, id);
1237 }
1238 }
1239
1240 TiXmlElement *x = new TiXmlElement(tag);
1241 std::string quadStr;
1243
1244 x->SetAttribute("COMPRESSED",
1246 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1247
1248 x->LinkEndChild(new TiXmlText(quadStr));
1249
1250 faceTag->LinkEndChild(x);
1251}
1252
1253void WriteHex(HexGeom *hex, std::vector<MeshHex> &elementInfo, int hexID)
1254{
1255 MeshHex e;
1256 e.id = hexID;
1257 e.f[0] = hex->GetFid(0);
1258 e.f[1] = hex->GetFid(1);
1259 e.f[2] = hex->GetFid(2);
1260 e.f[3] = hex->GetFid(3);
1261 e.f[4] = hex->GetFid(4);
1262 e.f[5] = hex->GetFid(5);
1263 elementInfo.push_back(e);
1264}
1265void MeshGraphIOXmlCompressed::v_WriteHexs(TiXmlElement *elmtTag,
1266 std::vector<int> keysToWrite)
1267{
1268 auto &hexes = m_meshGraph->GetGeomMap<HexGeom>();
1269
1270 if (hexes.size() == 0)
1271 {
1272 return;
1273 }
1274
1275 std::string tag = "H";
1276
1277 std::vector<MeshHex> elementInfo;
1278
1279 if (keysToWrite.empty())
1280 {
1281 for (auto [id, hex] : hexes)
1282 {
1283 WriteHex(hex, elementInfo, id);
1284 }
1285 }
1286 else
1287 {
1288 for (int id : keysToWrite)
1289 {
1290 WriteHex(hexes.at(id), elementInfo, id);
1291 }
1292 }
1293
1294 TiXmlElement *x = new TiXmlElement(tag);
1295 std::string elStr;
1297
1298 x->SetAttribute("COMPRESSED",
1300 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1301
1302 x->LinkEndChild(new TiXmlText(elStr));
1303
1304 elmtTag->LinkEndChild(x);
1305}
1306
1307void WritePrism(PrismGeom *prism, std::vector<MeshPrism> &elementInfo,
1308 int prismID)
1309{
1310 MeshPrism e;
1311 e.id = prismID;
1312 e.f[0] = prism->GetFid(0);
1313 e.f[1] = prism->GetFid(1);
1314 e.f[2] = prism->GetFid(2);
1315 e.f[3] = prism->GetFid(3);
1316 e.f[4] = prism->GetFid(4);
1317 elementInfo.push_back(e);
1318}
1320 std::vector<int> keysToWrite)
1321{
1322 auto &prisms = m_meshGraph->GetGeomMap<PrismGeom>();
1323
1324 if (prisms.size() == 0)
1325 {
1326 return;
1327 }
1328
1329 std::string tag = "R";
1330
1331 std::vector<MeshPrism> elementInfo;
1332
1333 if (keysToWrite.empty())
1334 {
1335 for (auto [id, prism] : prisms)
1336 {
1337 WritePrism(prism, elementInfo, id);
1338 }
1339 }
1340 else
1341 {
1342 for (int id : keysToWrite)
1343 {
1344 WritePrism(prisms.at(id), elementInfo, id);
1345 }
1346 }
1347
1348 TiXmlElement *x = new TiXmlElement(tag);
1349 std::string elStr;
1351
1352 x->SetAttribute("COMPRESSED",
1354 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1355
1356 x->LinkEndChild(new TiXmlText(elStr));
1357
1358 elmtTag->LinkEndChild(x);
1359}
1360
1361void WritePyr(PyrGeom *pyr, std::vector<MeshPyr> &elementInfo, int pyrID)
1362{
1363 MeshPyr e;
1364 e.id = pyrID;
1365 e.f[0] = pyr->GetFid(0);
1366 e.f[1] = pyr->GetFid(1);
1367 e.f[2] = pyr->GetFid(2);
1368 e.f[3] = pyr->GetFid(3);
1369 e.f[4] = pyr->GetFid(4);
1370 elementInfo.push_back(e);
1371}
1372void MeshGraphIOXmlCompressed::v_WritePyrs(TiXmlElement *elmtTag,
1373 std::vector<int> keysToWrite)
1374{
1375 auto &pyrs = m_meshGraph->GetGeomMap<PyrGeom>();
1376
1377 if (pyrs.size() == 0)
1378 {
1379 return;
1380 }
1381
1382 std::string tag = "P";
1383
1384 std::vector<MeshPyr> elementInfo;
1385
1386 if (keysToWrite.empty())
1387 {
1388 for (auto [id, pyr] : pyrs)
1389 {
1390 WritePyr(pyr, elementInfo, id);
1391 }
1392 }
1393 else
1394 {
1395 for (int id : keysToWrite)
1396 {
1397 WritePyr(pyrs.at(id), elementInfo, id);
1398 }
1399 }
1400
1401 TiXmlElement *x = new TiXmlElement(tag);
1402 std::string elStr;
1404
1405 x->SetAttribute("COMPRESSED",
1407 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1408
1409 x->LinkEndChild(new TiXmlText(elStr));
1410
1411 elmtTag->LinkEndChild(x);
1412}
1413
1414void WriteTet(TetGeom *tet, std::vector<MeshTet> &elementInfo, int tetID)
1415{
1416 MeshTet e;
1417 e.id = tetID;
1418 e.f[0] = tet->GetFid(0);
1419 e.f[1] = tet->GetFid(1);
1420 e.f[2] = tet->GetFid(2);
1421 e.f[3] = tet->GetFid(3);
1422 elementInfo.push_back(e);
1423}
1424void MeshGraphIOXmlCompressed::v_WriteTets(TiXmlElement *elmtTag,
1425 std::vector<int> keysToWrite)
1426{
1427 auto &tets = m_meshGraph->GetGeomMap<TetGeom>();
1428
1429 if (tets.size() == 0)
1430 {
1431 return;
1432 }
1433
1434 std::string tag = "A";
1435
1436 std::vector<MeshTet> elementInfo;
1437
1438 if (keysToWrite.empty())
1439 {
1440 for (auto [id, tet] : tets)
1441 {
1442 WriteTet(tet, elementInfo, id);
1443 }
1444 }
1445 else
1446 {
1447 for (int id : keysToWrite)
1448 {
1449 WriteTet(tets.at(id), elementInfo, id);
1450 }
1451 }
1452
1453 TiXmlElement *x = new TiXmlElement(tag);
1454 std::string elStr;
1456
1457 x->SetAttribute("COMPRESSED",
1459 x->SetAttribute("BITSIZE", LibUtilities::CompressData::GetBitSizeStr());
1460
1461 x->LinkEndChild(new TiXmlText(elStr));
1462
1463 elmtTag->LinkEndChild(x);
1464}
1465
1466void WriteCurvedEdge(CurveUniquePtr &curve, int key,
1467 std::vector<MeshCurvedInfo> &edgeInfo, int &edgeCnt,
1468 int &ptOffset, int &newIdx, MeshCurvedPts &curvedPts)
1469{
1470 MeshCurvedInfo cinfo;
1471 cinfo.id = edgeCnt++;
1472 cinfo.entityid = key;
1473 cinfo.npoints = curve->m_points.size();
1474 cinfo.ptype = curve->m_ptype;
1475 cinfo.ptid = 0;
1476 cinfo.ptoffset = ptOffset;
1477
1478 edgeInfo.push_back(cinfo);
1479
1480 for (int j = 0; j < curve->m_points.size(); j++)
1481 {
1482 MeshVertex v;
1483 v.id = newIdx;
1484 v.x = curve->m_points[j]->x();
1485 v.y = curve->m_points[j]->y();
1486 v.z = curve->m_points[j]->z();
1487 curvedPts.pts.push_back(v);
1488 curvedPts.index.push_back(newIdx);
1489 newIdx++;
1490 }
1491 ptOffset += cinfo.npoints;
1492}
1493void WriteCurvedFace(CurveUniquePtr &curve, int key,
1494 std::vector<MeshCurvedInfo> &faceInfo, int &faceCnt,
1495 int &ptOffset, int &newIdx, MeshCurvedPts &curvedPts)
1496{
1497 MeshCurvedInfo cinfo;
1498 cinfo.id = faceCnt++;
1499 cinfo.entityid = key;
1500 cinfo.npoints = curve->m_points.size();
1501 cinfo.ptype = curve->m_ptype;
1502 cinfo.ptid = 0;
1503 cinfo.ptoffset = ptOffset;
1504
1505 faceInfo.push_back(cinfo);
1506
1507 for (int j = 0; j < curve->m_points.size(); j++)
1508 {
1509 MeshVertex v;
1510 v.id = newIdx;
1511 v.x = curve->m_points[j]->x();
1512 v.y = curve->m_points[j]->y();
1513 v.z = curve->m_points[j]->z();
1514 curvedPts.pts.push_back(v);
1515 curvedPts.index.push_back(newIdx);
1516 newIdx++;
1517 }
1518 ptOffset += cinfo.npoints;
1519}
1521 CurveMap &edges, CurveMap &faces,
1522 std::vector<int> *keysToWriteEdges,
1523 std::vector<int> *keysToWriteFaces)
1524{
1525 if (edges.size() == 0 && faces.size() == 0)
1526 {
1527 return;
1528 }
1529 else if (keysToWriteEdges != nullptr && keysToWriteFaces != nullptr)
1530 {
1531 if (keysToWriteEdges->size() == 0 && keysToWriteFaces->size() == 0)
1532 {
1533 return;
1534 }
1535 }
1536
1537 TiXmlElement *curveTag = new TiXmlElement("CURVED");
1538
1539 std::vector<MeshCurvedInfo> edgeInfo;
1540 std::vector<MeshCurvedInfo> faceInfo;
1541 MeshCurvedPts curvedPts;
1542 curvedPts.id = 0;
1543 int ptOffset = 0;
1544 int newIdx = 0;
1545 int edgeCnt = 0;
1546 int faceCnt = 0;
1547
1548 if (keysToWriteEdges == nullptr)
1549 {
1550 for (auto &i : edges)
1551 {
1552 WriteCurvedEdge(i.second, i.first, edgeInfo, edgeCnt, ptOffset,
1553 newIdx, curvedPts);
1554 }
1555 }
1556 else
1557 {
1558 for (int key : *keysToWriteEdges)
1559 {
1560 WriteCurvedEdge(edges[key], key, edgeInfo, edgeCnt, ptOffset,
1561 newIdx, curvedPts);
1562 }
1563 }
1564
1565 if (keysToWriteFaces == nullptr)
1566 {
1567 for (auto &i : faces)
1568 {
1569 WriteCurvedFace(i.second, i.first, faceInfo, faceCnt, ptOffset,
1570 newIdx, curvedPts);
1571 }
1572 }
1573 else
1574 {
1575 for (int key : *keysToWriteFaces)
1576 {
1577 WriteCurvedFace(faces[key], key, faceInfo, faceCnt, ptOffset,
1578 newIdx, curvedPts);
1579 }
1580 }
1581
1582 curveTag->SetAttribute("COMPRESSED",
1584 curveTag->SetAttribute("BITSIZE",
1586
1587 if (edgeInfo.size())
1588 {
1589 TiXmlElement *x = new TiXmlElement("E");
1590 std::string dataStr;
1592
1593 x->LinkEndChild(new TiXmlText(dataStr));
1594 curveTag->LinkEndChild(x);
1595 }
1596
1597 if (faceInfo.size())
1598 {
1599 TiXmlElement *x = new TiXmlElement("F");
1600 std::string dataStr;
1602
1603 x->LinkEndChild(new TiXmlText(dataStr));
1604 curveTag->LinkEndChild(x);
1605 }
1606
1607 if (edgeInfo.size() || faceInfo.size())
1608 {
1609 TiXmlElement *x = new TiXmlElement("DATAPOINTS");
1610 x->SetAttribute("ID", curvedPts.id);
1611 TiXmlElement *subx = new TiXmlElement("INDEX");
1612 std::string dataStr;
1614 dataStr);
1615 subx->LinkEndChild(new TiXmlText(dataStr));
1616 x->LinkEndChild(subx);
1617
1618 subx = new TiXmlElement("POINTS");
1620 dataStr);
1621 subx->LinkEndChild(new TiXmlText(dataStr));
1622 x->LinkEndChild(subx);
1623 curveTag->LinkEndChild(x);
1624 }
1625
1626 geomTag->LinkEndChild(curveTag);
1627}
1628} // namespace Nektar::SpatialDomains
#define ASSERTL0(condition, msg)
Interpreter class for the evaluation of mathematical expressions.
Definition Interpreter.h:76
int DefineFunction(const std::string &vlist, const std::string &expr)
Defines a function for the purposes of evaluation.
NekDouble Evaluate(const int id)
Evaluate a function which depends only on constants and/or parameters.
tKey RegisterCreatorFunction(tKey idKey, CreatorFunction classCreator, std::string pDesc="")
Register a class with the factory.
boost::call_traits< DataType >::const_reference x() const
Definition NekPoint.hpp:160
boost::call_traits< DataType >::const_reference z() const
Definition NekPoint.hpp:172
boost::call_traits< DataType >::const_reference y() const
Definition NekPoint.hpp:166
Generic object pool allocator/deallocator.
static std::unique_ptr< DataType, UniquePtrDeleter > AllocateUniquePtr(const Args &...args)
2D geometry information
Definition Geometry2D.h:50
LibUtilities::ShapeType GetShapeType(void)
Get the geometric shape type of this object.
Definition Geometry.h:294
int GetVid(int i) const
Returns global id of vertex i of this object.
Definition Geometry.h:345
int GetFid(int i) const
Get the ID of face i of this object.
Definition Geometry.cpp:91
int GetEid(int i) const
Get the ID of edge i of this object.
Definition Geometry.cpp:83
void v_WriteTris(TiXmlElement *faceTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WritePyrs(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WriteCurves(TiXmlElement *geomTag, CurveMap &edges, CurveMap &faces, std::vector< int > *keysToWriteEdges=nullptr, std::vector< int > *keysToWriteFaces=nullptr) override
void v_WriteVertices(TiXmlElement *geomTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WritePrisms(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WriteHexs(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WriteTets(TiXmlElement *elmtTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WriteEdges(TiXmlElement *geomTag, std::vector< int > keysToWrite=std::vector< int >()) override
void v_WriteQuads(TiXmlElement *faceTag, std::vector< int > keysToWrite=std::vector< int >()) override
int ZlibDecodeFromBase64Str(std::string &in64, std::vector< T > &out)
int ZlibEncodeToBase64Str(std::vector< T > &in, std::string &out64)
unique_ptr_objpool< Curve > CurveUniquePtr
Definition Geometry.h:70
void WriteVert(PointGeom *vert, TiXmlElement *vertTag)
void WriteCurvedFace(CurveUniquePtr &curve, TiXmlElement *curveTag, int &curveId)
std::map< int, CurveUniquePtr > CurveMap
Definition Geometry.h:71
void WritePrism(PrismGeom *pri, TiXmlElement *elmtTag, std::string &tag, int priID)
void WriteTri(TriGeom *tri, TiXmlElement *faceTag, std::string &tag, int triID)
void WriteEdge(SegGeom *seg, TiXmlElement *edgeTag, std::string &tag, int edgeID)
void WriteCurvedEdge(CurveUniquePtr &curve, TiXmlElement *curveTag, int &curveId)
void WriteQuad(QuadGeom *quad, TiXmlElement *faceTag, std::string &tag, int quadID)
void WriteHex(HexGeom *hex, TiXmlElement *elmtTag, std::string &tag, int hexID)
MeshGraphIOFactory & GetMeshGraphIOFactory()
void WritePyr(PyrGeom *pyr, TiXmlElement *elmtTag, std::string &tag, int pyrID)
unique_ptr_objpool< SegGeom > SegGeomUniquePtr
Definition MeshGraph.h:102
void WriteTet(TetGeom *tet, TiXmlElement *elmtTag, std::string &tag, int tetID)
std::int32_t int32_t
int64_t ptype
point offset of data entry for this curve
int64_t npoints
The entity id corresponding to the global edge/curve.
int64_t ptoffset
the id of point data map (currently always 0 since we are using just one set).
int64_t entityid
Id of this curved information.
int64_t ptid
The number of points in this curved entity.
std::vector< int64_t > index
Mapping to access the pts value. Given a 'ptoffset' value the npoints subsquent values provide the in...
std::vector< MeshVertex > pts
mapping to access pts value.