/usr/include/XdmfWriter.hpp is in libxdmf-dev 3.0+git20160803-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 | /*****************************************************************************/
/* XDMF */
/* eXtensible Data Model and Format */
/* */
/* Id : XdmfWriter.hpp */
/* */
/* Author: */
/* Kenneth Leiter */
/* kenneth.leiter@arl.army.mil */
/* US Army Research Laboratory */
/* Aberdeen Proving Ground, MD */
/* */
/* Copyright @ 2011 US Army Research Laboratory */
/* All Rights Reserved */
/* See Copyright.txt for details */
/* */
/* This software is distributed WITHOUT ANY WARRANTY; without */
/* even the implied warranty of MERCHANTABILITY or FITNESS */
/* FOR A PARTICULAR PURPOSE. See the above copyright notice */
/* for more information. */
/* */
/*****************************************************************************/
#ifndef XDMFWRITER_HPP_
#define XDMFWRITER_HPP_
// C Compatible Includes
#include "XdmfCore.hpp"
#include "XdmfHeavyDataWriter.hpp"
#include "XdmfVisitor.hpp"
#ifdef __cplusplus
// Forward Declarations
class XdmfArray;
class XdmfInformation;
class XdmfHeavyDataWriter;
/**
* @brief Traverse the Xdmf graph and write light and heavy data
* stored to disk.
*
* XdmfWriter visits each node of an Xdmf graph structure and writes
* data to disk. Writing begins by calling the accept() operation on
* any XdmfItem and supplying this writer as the parameter. The
* XdmfItem as well as all children attached to the XdmfItem are
* written to disk. Heavy data is written to a heavy data format using
* an XdmfHeavyDataWriter and light data is written to XML.
*
* An infinite loop is possible if an XdmfItem somehow ends up as its own child,
* either directly or by way of another Xdmf Item.
*
* By default, the XdmfWriter writes all heavy data to a single heavy
* data file specified by the XdmfHeavyDataWriter. If a dataset is
* encountered that resides in a different heavy data file on disk,
* the dataset is read from disk and written to the new heavy data
* file. If this is undesired, the XdmfWriter can be set to
* DistributedHeavyData mode in which the writer will automatically
* reference any heavy dataset even if it resides in a different file
* than the one currently being written to.
*/
class XDMFCORE_EXPORT XdmfWriter : public XdmfVisitor,
public Loki::Visitor<XdmfArray> {
public:
enum Mode {
Default,
DistributedHeavyData
};
/**
* Create a new XdmfWriter to write Xdmf data to disk. This will
* create its own hdf5 writer based on the xmlFileName. For example,
* if supplied "output.xmf" the created hdf5 writer would write to
* file "output.h5".
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#initialization
* @until //#initialization
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//initialization
* @until #//initialization
*
* @param xmlFilePath The path to the xml file to write to.
*
* @return The new XdmfWriter.
*/
static shared_ptr<XdmfWriter> New(const std::string & xmlFilePath);
/**
* Create a new XdmfWriter to write Xdmf data to disk. This will
* utilize the passed heavy data writer to write any heavy data to
* disk.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
*
* @param xmlFilePath The path to the xml file to write to.
* @param heavyDataWriter The heavy data writer to use when writing.
*
* @return The new XdmfWriter.
*/
static shared_ptr<XdmfWriter> New(const std::string & xmlFilePath,
const shared_ptr<XdmfHeavyDataWriter> heavyDataWriter);
/**
* Create a new XdmfWriter to write Xdmf data to disk. This will
* write heavy data to disk using the passed heavy data writer and
* will add xml output to the stream.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline #//bufferinitialization
* @until #//bufferinitialization
*
* Python: does not curretnly support this version of New
*
* @param stream The output stream to write light data to.
* @param heavyDataWriter The heavy data writer to use when writing.
*
* @return The new XdmfWriter.
*/
static shared_ptr<XdmfWriter> New(std::ostream & stream,
const shared_ptr<XdmfHeavyDataWriter> heavyDataWriter);
virtual ~XdmfWriter();
/**
* Get the absolute path to the XML file on disk this writer is
* writing to.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getFilePath
* @until //#getFilePath
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getFilePath
* @until //#getFilePath
*
* @return A std::string containing the path to the XML file on disk this
* writer is writing to.
*/
std::string getFilePath() const;
/**
* Get the heavy data writer that this XdmfWriter uses to write
* heavy data to disk.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getHeavyDataWriter
* @until //#getHeavyDataWriter
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getHeavyDataWriter
* @until #//getHeavyDataWriter
*
* @return The requested heavy data writer.
*/
shared_ptr<XdmfHeavyDataWriter> getHeavyDataWriter();
/**
* Get the heavy data writer that this XdmfWriter uses to write
* heavy data to disk (const version).
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getHeavyDataWriterconst
* @until //#getHeavyDataWriterconst
*
* Python: Does not support a contant version of this function
*
* @return The requested heavy data writer.
*/
shared_ptr<const XdmfHeavyDataWriter> getHeavyDataWriter() const;
/**
* Get the number of values that this writer writes to light data
* (XML) before switching to a heavy data format.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getLightDataLimit
* @until //#getLightDataLimit
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getLightDataLimit
* @until #//getLightDataLimit
*
* @return An unsigned int containing the number of values.
*/
unsigned int getLightDataLimit() const;
/**
* Get the Mode of operation for this writer.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getMode
* @until //#getMode
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getMode
* @until #//getMode
*
* @return The Mode of operation for this writer.
*/
Mode getMode() const;
/**
* Gets whether XML is rebuilt with each write.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getRebuildXML
* @until //#getRebuildXML
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getRebuildXML
* @until #//getRebuildXML
*
* @return Whether XML will be rebuilt.
*/
bool getRebuildXML();
/**
* Get whether this writer is set to write xpaths.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getWriteXPaths
* @until //#getWriteXPaths
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getWriteXPaths
* @until #//getWriteXPaths
*
* @return bool whether this writer is set to write xpaths.
*/
bool getWriteXPaths() const;
/**
* Get whether this writer is set to parse xpaths from information.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getXPathParse
* @until //#getXPathParse
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getXPathParse
* @until #//getXPathParse
*
* @return bool whether this writer is set to write xpaths.
*/
bool getXPathParse() const;
/**
* Set the heavy data writer that this XdmfWriter uses to write
* heavy data to disk.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#getHeavyDataWriter
* @until //#getHeavyDataWriter
* @skipline //#setHeavyDataWriter
* @until //#setHeavyDataWriter
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//getHeavyDataWriter
* @until #//getHeavyDataWriter
* @skipline #//setHeavyDataWriter
* @until #//setHeavyDataWriter
*
* @param heavyDataWriter The heavy data writer to set.
*/
void setHeavyDataWriter(shared_ptr<XdmfHeavyDataWriter> heavyDataWriter);
/**
* Set the number of values that this writer writes to light data
* (XML) before switching to a heavy data format.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#setLightDataLimit
* @until //#setLightDataLimit
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//setLightDataLimit
* @until #//setLightDataLimit
*
* @param numValues An unsigned int containing the number of values.
*/
void setLightDataLimit(const unsigned int numValues);
/**
* Set the mode of operation for this writer.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#setMode
* @until //#setMode
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//setMode
* @until #//setMode
*
* @param mode The Mode of operation for this writer.
*/
void setMode(const Mode mode);
/**
* Sets whether XML will be rebuilt with each write.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#setRebuildXML
* @until //#setRebuildXML
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//setRebuildXML
* @until #//setRebuildXML
*
* @param newStatus Whether to rebuild XML.
*/
void setRebuildXML(bool newStatus);
/**
* Set whether to write xpaths for this writer.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#setWriteXPaths
* @until //#setWriteXPaths
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//setWriteXPaths
* @until #//setWriteXPaths
*
* @param writeXPaths Whether to write xpaths for this writer.
*/
void setWriteXPaths(const bool writeXPaths = true);
/**
* Set whether to parse xpaths from infomation for this writer.
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#heavyinitialization
* @until //#heavyinitialization
* @skipline //#setXPathParse
* @until //#setXPathParse
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//heavyinitialization
* @until #//heavyinitialization
* @skipline #//setXPathParse
* @until #//setXPathParse
*
* @param xPathParse Whether to write xpaths for this writer.
*/
void setXPathParse(const bool xPathParse = true);
/**
* Write an XdmfArray to disk
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#visitarray
* @until //#visitarray
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//visitarray
* @until #//visitarray
*
* @param array An XdmfArray to write to disk.
* @param visitor A smart pointer to this visitor --- aids in grid traversal.
*/
virtual void visit(XdmfArray & array,
const shared_ptr<XdmfBaseVisitor> visitor);
/**
* Write an XdmfItem to disk
*
* Example of use:
*
* C++
*
* @dontinclude ExampleXdmfWriter.cpp
* @skipline //#visititem
* @until //#visititem
*
* Python
*
* @dontinclude XdmfExampleWriter.py
* @skipline #//visititem
* @until #//visititem
*
* @param item An XdmfItem to write to disk.
* @param visitor A smart pointer to this visitor --- aids in grid traversal.
*/
virtual void visit(XdmfItem & item,
const shared_ptr<XdmfBaseVisitor> visitor);
XdmfWriter(const XdmfWriter &);
protected:
XdmfWriter(const std::string & xmlFilePath,
shared_ptr<XdmfHeavyDataWriter> heavyDataWriter,
std::ostream * stream = NULL);
xmlNodePtr getXMLNode(XdmfItem * item, xmlDocPtr parentDoc, xmlNodePtr parentNode);
bool getHasXMLArchive(XdmfItem * item);
void setXMLNode(XdmfItem * item, xmlNodePtr & newNode);
void setDocumentTitle(std::string title);
void setVersionString(std::string version);
bool mRebuildAlreadyVisited;
std::map<XdmfItem *, xmlNodePtr> mXMLArchive;
private:
/**
* PIMPL
*/
class XdmfWriterImpl;
void operator=(const XdmfWriter &); // Not implemented.
XdmfWriterImpl * mImpl;
};
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define XDMF_WRITER_MODE_DEFAULT 30
#define XDMF_WRITER_MODE_DISTRIBUTED_HEAVY_DATA 31
// C wrappers go here
struct XDMFWRITER; // Simply as a typedef to ensure correct typing
typedef struct XDMFWRITER XDMFWRITER;
XDMFCORE_EXPORT XDMFWRITER * XdmfWriterNew(char * fileName);
XDMFCORE_EXPORT XDMFWRITER * XdmfWriterNewSpecifyHeavyDataWriter(char * fileName, XDMFHEAVYDATAWRITER * heavyDataWriter);
XDMFCORE_EXPORT void XdmfWriterFree(XDMFWRITER * item);
XDMFCORE_EXPORT char * XdmfWriterGetFilePath(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT XDMFHEAVYDATAWRITER * XdmfWriterGetHeavyDataWriter(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT unsigned int XdmfWriterGetLightDataLimit(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT int XdmfWriterGetMode(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT int XdmfWriterGetWriteXPaths(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT int XdmfWriterGetXPathParse(XDMFWRITER * writer, int * status);
XDMFCORE_EXPORT void XdmfWriterSetHeavyDataWriter(XDMFWRITER * writer, XDMFHEAVYDATAWRITER * heavyDataWriter, int transferOwnership, int * status);
XDMFCORE_EXPORT void XdmfWriterSetLightDataLimit(XDMFWRITER * writer, unsigned int numValues, int * status);
XDMFCORE_EXPORT void XdmfWriterSetMode(XDMFWRITER * writer, int mode, int * status);
XDMFCORE_EXPORT void XdmfWriterSetWriteXPaths(XDMFWRITER * writer, int writeXPaths, int * status);
XDMFCORE_EXPORT void XdmfWriterSetXPathParse(XDMFWRITER * writer, int xPathParse, int * status);
#ifdef __cplusplus
}
#endif
#endif /* XDMFWRITER_HPP_ */
|