Skip to content

Commit f5a1b27

Browse files
committed
Generate error message if attempting to use VTK writer with OutputSolnPoints.
1 parent 79b039a commit f5a1b27

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

libsrc/pylith/meshio/OutputSolnPoints.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include "pylith/meshio/OutputSolnPoints.hh" // implementation of class methods
1414

1515
#include "pylith/meshio/DataWriter.hh" // USES DataWriter
16+
#include "pylith/meshio/DataWriterVTK.hh" // USES DataWriterVTK
1617
#include "pylith/meshio/MeshBuilder.hh" // USES MeshBuilder
1718

1819
#include "pylith/topology/Mesh.hh" // USES Mesh
@@ -106,6 +107,10 @@ pylith::meshio::OutputSolnPoints::_writeSolnStep(const PylithReal t,
106107
PYLITH_METHOD_BEGIN;
107108
PYLITH_COMPONENT_DEBUG("_writeSolnStep(t="<<t<<", tindex="<<tindex<<", solution="<<solution.getLabel()<<")");
108109

110+
if (dynamic_cast<pylith::meshio::DataWriterVTK*>(_writer)) {
111+
PYLITH_JOURNAL_LOGICERROR("PETSc VTK writer using the VTU format does not support output at points. Use the default DataWriterHDF5 writer.");
112+
} // if
113+
109114
if (!_interpolator) {
110115
_setupInterpolator(solution);
111116
} // if

pylith/meshio/OutputSolnPoints.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,18 @@ def preinitialize(self, problem):
8383

8484
# PRIVATE METHODS ////////////////////////////////////////////////////
8585

86+
def _validate(self, context):
87+
from .DataWriterVTK import DataWriterVTK
88+
if isinstance(self.inventory.writer, DataWriterVTK):
89+
trait = self.inventory.getTrait("writer")
90+
self._validationError(context, trait, "PETSc VTK writer using the VTU format does not support output at points. Use the default DataWriterHDF5 writer.")
91+
92+
def _validationError(self, context, trait, msg):
93+
from pythia.pyre.inventory.Item import Item
94+
error = ValueError(msg)
95+
descriptor = self.getTraitDescriptor(trait.name)
96+
context.error(error, items=[Item(trait, descriptor)])
97+
8698
def _createModuleObj(self):
8799
"""Create handle to C++ object.
88100
"""

0 commit comments

Comments
 (0)