[cig-commits] r18598 - in short/3D/PyLith/trunk: doc/userguide/runpylith doc/userguide/tutorials/subduction libsrc/pylith/meshio unittests/libtests/meshio/data
brad at geodynamics.org
brad at geodynamics.org
Sun Jun 12 14:14:18 PDT 2011
Author: brad
Date: 2011-06-12 14:14:18 -0700 (Sun, 12 Jun 2011)
New Revision: 18598
Modified:
short/3D/PyLith/trunk/doc/userguide/runpylith/runpylith.lyx
short/3D/PyLith/trunk/doc/userguide/tutorials/subduction/subduction.lyx
short/3D/PyLith/trunk/libsrc/pylith/meshio/Xdmf.cc
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.xmf
short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.xmf
Log:
Fixed Xdmf file for 2-D tensors (write components). Adjusted component output to specify components using suffix rather than prefix.
Modified: short/3D/PyLith/trunk/doc/userguide/runpylith/runpylith.lyx
===================================================================
--- short/3D/PyLith/trunk/doc/userguide/runpylith/runpylith.lyx 2011-06-12 19:59:18 UTC (rev 18597)
+++ short/3D/PyLith/trunk/doc/userguide/runpylith/runpylith.lyx 2011-06-12 21:14:18 UTC (rev 18598)
@@ -4463,7 +4463,15 @@
As a result, we separate the components of two-dimensional vector and tensor
vector field objects and add the component as a suffix to the name of the
field.
- The vector can be reconstructed within ParaView using the Calculator.
+ The vector can be reconstructed within ParaView using the Calculator (see
+ Section
+\begin_inset CommandInset ref
+LatexCommand ref
+reference "sec:Tutorial-Subduction"
+
+\end_inset
+
+ for an example).
Accessing the datasets in the HDF5 files using tools such as PyTables with
visualization through MayaVi circumvents this problem, but requires writing
Python scripts and a deeper knowledge of the visualization interface.
Modified: short/3D/PyLith/trunk/doc/userguide/tutorials/subduction/subduction.lyx
===================================================================
--- short/3D/PyLith/trunk/doc/userguide/tutorials/subduction/subduction.lyx 2011-06-12 19:59:18 UTC (rev 18597)
+++ short/3D/PyLith/trunk/doc/userguide/tutorials/subduction/subduction.lyx 2011-06-12 21:14:18 UTC (rev 18598)
@@ -654,7 +654,11 @@
pairs of files), physical properties, stress, and strain within each material
(eight pairs of files), and fault parameters, slip, and traction (two pairs
of files).
- Figure
+
+\end_layout
+
+\begin_layout Standard
+Figure
\begin_inset CommandInset ref
LatexCommand ref
reference "fig:tutorial:subduction:step01"
@@ -663,9 +667,20 @@
, which was created using ParaView, displays the magnitude of the displacement
field with the deformation exaggerated by a factor of 1000.
+ We construct a three-dimensional displacement vector from the two-dimensional
+ displacement components using the Calculator with the expression
\end_layout
+\begin_layout LyX-Code
+displacement_x*iHat + displacement_y*jHat + kHat
+\end_layout
+
\begin_layout Standard
+where we select the displacement components from the Scalars drop-down menu
+ and the iHat, jHat, and kHat values from the Calculator buttons.
+\end_layout
+
+\begin_layout Standard
\noindent
\align center
\begin_inset Float figure
Modified: short/3D/PyLith/trunk/libsrc/pylith/meshio/Xdmf.cc
===================================================================
--- short/3D/PyLith/trunk/libsrc/pylith/meshio/Xdmf.cc 2011-06-12 19:59:18 UTC (rev 18597)
+++ short/3D/PyLith/trunk/libsrc/pylith/meshio/Xdmf.cc 2011-06-12 21:14:18 UTC (rev 18598)
@@ -158,8 +158,10 @@
for (int iField=0; iField < numFields; ++iField) {
if (2 == spaceDim &&
- std::string("Vector") == fieldsMetadata[iField].vectorFieldType) {
- for (int component=0; component < spaceDim; ++component)
+ (std::string("Vector") == fieldsMetadata[iField].vectorFieldType ||
+ std::string("Tensor") == fieldsMetadata[iField].vectorFieldType) ) {
+ const int fiberDim = fieldsMetadata[iField].fiberDim;
+ for (int component=0; component < fiberDim; ++component)
_writeGridAttributeComponent(fieldsMetadata[iField],
iTimeStep, component);
} else {
@@ -178,8 +180,10 @@
const int iTimeStep = 0;
for (int iField=0; iField < numFields; ++iField) {
if (2 == spaceDim &&
- std::string("Vector") == fieldsMetadata[iField].vectorFieldType) {
- for (int component=0; component < spaceDim; ++component)
+ (std::string("Vector") == fieldsMetadata[iField].vectorFieldType ||
+ std::string("Tensor") == fieldsMetadata[iField].vectorFieldType) ) {
+ const int fiberDim = fieldsMetadata[iField].fiberDim;
+ for (int component=0; component < fiberDim; ++component)
_writeGridAttributeComponent(fieldsMetadata[iField],
iTimeStep, component);
} else {
@@ -511,26 +515,52 @@
} // if/else
std::string componentName = "unknown";
- switch (component) {
- case 0:
- componentName = std::string("x_") + std::string(metadata.name);
- break;
- case 1:
- componentName = std::string("y_") + std::string(metadata.name);
- break;
- case 2:
- componentName = std::string("z_") + std::string(metadata.name);
- break;
- default:
- { // default
- std::ostringstream msg;
- msg << "Unknown component " << component << " while writing Xdmf file.";
- std::cerr << msg.str() << std::endl;
- assert(0);
+ if (std::string("Vector") == metadata.vectorFieldType) {
+ switch (component) {
+ case 0:
+ componentName = std::string(metadata.name) + std::string("_x");
+ break;
+ case 1:
+ componentName = std::string(metadata.name) + std::string("_y");
+ break;
+ default:
+ { // default
+ std::ostringstream msg;
+ msg << "Unknown component " << component << " while writing Xdmf file.";
+ std::cerr << msg.str() << std::endl;
+ assert(0);
+ throw std::logic_error(msg.str());
+ } // default
+ } // switch
+ } else if (std::string("Tensor") == metadata.vectorFieldType) {
+ switch (component) {
+ case 0:
+ componentName = std::string(metadata.name) + std::string("_xx");
+ break;
+ case 1:
+ componentName = std::string(metadata.name) + std::string("_yy");
+ break;
+ case 2:
+ componentName = std::string(metadata.name) + std::string("_xy");
+ break;
+ default:
+ { // default
+ std::ostringstream msg;
+ msg << "Unknown component " << component << " while writing Xdmf file.";
+ std::cerr << msg.str() << std::endl;
+ assert(0);
+ throw std::logic_error(msg.str());
+ } // default
+ } // switch
+ } else {
+ std::ostringstream msg;
+ msg << "Unknown vector field type " << metadata.vectorFieldType
+ << " while writing Xdmf file.";
+ std::cerr << msg.str() << std::endl;
+ assert(0);
throw std::logic_error(msg.str());
- } // default
- } // switch
-
+ } // else
+
_file
<< " <Attribute\n"
<< " Name=\"" << componentName << "\"\n"
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.xmf
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.xmf 2011-06-12 19:59:18 UTC (rev 18597)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_cell.xmf 2011-06-12 21:14:18 UTC (rev 18598)
@@ -32,18 +32,18 @@
</DataItem>
</Geometry>
<Attribute
- Name="other"
- Type="Tensor"
+ Name="other_xx"
+ Type="Scalar"
Center="Cell">
<DataItem ItemType="HyperSlab"
- Dimensions="1 2 3"
+ Dimensions="1 2 1"
Type="HyperSlab">
<DataItem
Dimensions="3 3"
Format="XML">
0 0 0
1 1 1
- 1 2 3
+ 1 2 1
</DataItem>
<DataItem
DataType="Float" Precision="8"
@@ -54,6 +54,50 @@
</DataItem>
</Attribute>
<Attribute
+ Name="other_yy"
+ Type="Scalar"
+ Center="Cell">
+ <DataItem ItemType="HyperSlab"
+ Dimensions="1 2 1"
+ Type="HyperSlab">
+ <DataItem
+ Dimensions="3 3"
+ Format="XML">
+ 0 0 1
+ 1 1 1
+ 1 2 1
+ </DataItem>
+ <DataItem
+ DataType="Float" Precision="8"
+ Dimensions="1 2 3"
+ Format="HDF">
+ &HeavyData;:/cell_fields/other
+ </DataItem>
+ </DataItem>
+ </Attribute>
+ <Attribute
+ Name="other_xy"
+ Type="Scalar"
+ Center="Cell">
+ <DataItem ItemType="HyperSlab"
+ Dimensions="1 2 1"
+ Type="HyperSlab">
+ <DataItem
+ Dimensions="3 3"
+ Format="XML">
+ 0 0 2
+ 1 1 1
+ 1 2 1
+ </DataItem>
+ <DataItem
+ DataType="Float" Precision="8"
+ Dimensions="1 2 3"
+ Format="HDF">
+ &HeavyData;:/cell_fields/other
+ </DataItem>
+ </DataItem>
+ </Attribute>
+ <Attribute
Name="pressure"
Type="Scalar"
Center="Cell">
@@ -76,7 +120,7 @@
</DataItem>
</Attribute>
<Attribute
- Name="x_traction"
+ Name="traction_x"
Type="Scalar"
Center="Cell">
<DataItem ItemType="HyperSlab"
@@ -98,7 +142,7 @@
</DataItem>
</Attribute>
<Attribute
- Name="y_traction"
+ Name="traction_y"
Type="Scalar"
Center="Cell">
<DataItem ItemType="HyperSlab"
Modified: short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.xmf
===================================================================
--- short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.xmf 2011-06-12 19:59:18 UTC (rev 18597)
+++ short/3D/PyLith/trunk/unittests/libtests/meshio/data/tri3_vertex.xmf 2011-06-12 21:14:18 UTC (rev 18598)
@@ -32,7 +32,7 @@
</DataItem>
</Geometry>
<Attribute
- Name="x_displacements"
+ Name="displacements_x"
Type="Scalar"
Center="Node">
<DataItem ItemType="HyperSlab"
@@ -54,7 +54,7 @@
</DataItem>
</Attribute>
<Attribute
- Name="y_displacements"
+ Name="displacements_y"
Type="Scalar"
Center="Node">
<DataItem ItemType="HyperSlab"
More information about the CIG-COMMITS
mailing list