<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"> <title>VTK: dox/Hybrid/vtkExodusIIReaderParser.h Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> <link href="tabs.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.5.6 --> <div class="navigation" id="top"> <div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="classes.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <h1>dox/Hybrid/vtkExodusIIReaderParser.h</h1><a href="a02823.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*=========================================================================</span> <a name="l00002"></a>00002 <span class="comment"></span> <a name="l00003"></a>00003 <span class="comment"> Program: ParaView</span> <a name="l00004"></a>00004 <span class="comment"> Module: $RCSfile: vtkExodusIIReaderParser.h,v $</span> <a name="l00005"></a>00005 <span class="comment"></span> <a name="l00006"></a>00006 <span class="comment"> Copyright (c) Kitware, Inc.</span> <a name="l00007"></a>00007 <span class="comment"> All rights reserved.</span> <a name="l00008"></a>00008 <span class="comment"> See Copyright.txt or http://www.paraview.org/HTML/Copyright.html for details.</span> <a name="l00009"></a>00009 <span class="comment"></span> <a name="l00010"></a>00010 <span class="comment"> This software is distributed WITHOUT ANY WARRANTY; without even</span> <a name="l00011"></a>00011 <span class="comment"> the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR</span> <a name="l00012"></a>00012 <span class="comment"> PURPOSE. See the above copyright notice for more information.</span> <a name="l00013"></a>00013 <span class="comment"></span> <a name="l00014"></a>00014 <span class="comment">=========================================================================*/</span> <a name="l00022"></a>00022 <span class="preprocessor">#ifndef __vtkExodusIIReaderParser_h</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define __vtkExodusIIReaderParser_h</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="a03236.html">vtkXMLParser.h</a>"</span> <a name="l00026"></a>00026 <span class="preprocessor">#include "<a class="code" href="a02127.html">vtkSmartPointer.h</a>"</span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#include <vtksys/ios/sstream></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <vtkstd/map></span> <a name="l00030"></a>00030 <span class="preprocessor">#include <vtkstd/vector></span> <a name="l00031"></a>00031 <span class="preprocessor">#include <vtkstd/set></span> <a name="l00032"></a>00032 <span class="preprocessor">#include <vtkstd/string></span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keyword">class </span><a class="code" href="a01071.html" title="An editable directed graph.">vtkMutableDirectedGraph</a>; <a name="l00035"></a>00035 <span class="keyword">class </span><a class="code" href="a01619.html" title="Subclass of vtkAbstractArray that holds vtkStdStrings.">vtkStringArray</a>; <a name="l00036"></a>00036 <span class="keyword">class </span><a class="code" href="a01784.html" title="dynamic, self-adjusting array of unsigned char">vtkUnsignedCharArray</a>; <a name="l00037"></a>00037 <a name="l00038"></a><a class="code" href="a00477.html">00038</a> <span class="keyword">class </span><a class="code" href="a02170.html#9e9a05a8377523b4f8d707441f65786d">VTK_HYBRID_EXPORT</a> <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a> : <span class="keyword">public</span> <a class="code" href="a01921.html" title="Parse XML to handle element tags and attributes.">vtkXMLParser</a> <a name="l00039"></a>00039 { <a name="l00040"></a>00040 <span class="keyword">public</span>: <a name="l00041"></a>00041 <span class="keyword">static</span> <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>* <a class="code" href="a01921.html#44ed68fb0b80289d123905ce4c835366">New</a>(); <a name="l00042"></a><a class="code" href="a00477.html#2f797fe3ca5022ae66bbc85f061f08e2">00042</a> vtkTypeRevisionMacro(<a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>, <a class="code" href="a01921.html" title="Parse XML to handle element tags and attributes.">vtkXMLParser</a>); <a name="l00043"></a>00043 <span class="keywordtype">void</span> <a class="code" href="a01921.html#14ba49410a6f729cbbe4f98a07d3aa0f">PrintSelf</a>(ostream& os, <a class="code" href="a00869.html" title="a simple class to control print indentation">vtkIndent</a> indent); <a name="l00044"></a>00044 <a name="l00046"></a>00046 <a name="l00047"></a>00047 vtkGetObjectMacro(SIL, <a class="code" href="a01071.html" title="An editable directed graph.">vtkMutableDirectedGraph</a>); <a name="l00049"></a>00049 <a name="l00051"></a>00051 <span class="keywordtype">void</span> Go(<span class="keyword">const</span> <span class="keywordtype">char</span>* filename); <a name="l00052"></a>00052 <a name="l00053"></a>00053 <span class="comment">// Returns if the parser has some information about the block with given "id".</span> <a name="l00054"></a>00054 <span class="comment">// This is valid only after Go().</span> <a name="l00055"></a><a class="code" href="a00477.html#2cdf67040762725571777cd5ba027fc6">00055</a> <span class="keywordtype">bool</span> HasInformationAboutBlock(<span class="keywordtype">int</span> <span class="keywordtype">id</span>) <a name="l00056"></a>00056 { <a name="l00057"></a>00057 <span class="keywordflow">return</span> (this->BlockID_To_VertexID.find(<span class="keywordtype">id</span>) != this->BlockID_To_VertexID.end()); <a name="l00058"></a>00058 } <a name="l00059"></a>00059 <a name="l00062"></a>00062 <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210ff2af282e340f7884417cb571d333ccc">vtkstd::string</a> GetBlockName(<span class="keywordtype">int</span> <span class="keywordtype">id</span>); <a name="l00063"></a>00063 <a name="l00065"></a>00065 <a name="l00067"></a><a class="code" href="a00477.html#f7c9321a41c4933ffaddc516b1e51123">00067</a> <span class="keywordtype">void</span> GetBlockIds(vtkstd::set<int>& blockIdsSet) <a name="l00068"></a>00068 { <a name="l00069"></a>00069 vtkstd::map<int, vtkIdType>::iterator iter; <a name="l00070"></a>00070 <span class="keywordflow">for</span> (iter = this->BlockID_To_VertexID.begin(); <a name="l00071"></a>00071 iter != this->BlockID_To_VertexID.end(); <a name="l00072"></a>00072 ++iter) <a name="l00073"></a>00073 { <a name="l00074"></a>00074 blockIdsSet.insert(iter->first); <a name="l00075"></a>00075 } <a name="l00076"></a>00076 } <a name="l00078"></a>00078 <span class="comment">//BTX</span> <a name="l00079"></a>00079 <span class="keyword">protected</span>: <a name="l00080"></a>00080 <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>(); <a name="l00081"></a>00081 ~<a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>(); <a name="l00082"></a>00082 <a name="l00083"></a>00083 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a01921.html#58515549efb9effe86587c200cc3fa0f">StartElement</a>( <span class="keyword">const</span> <span class="keywordtype">char</span>* tagName, <span class="keyword">const</span> <span class="keywordtype">char</span>** attrs); <a name="l00084"></a>00084 <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="a01921.html#093c0589a4a834bcf67c9c4ce3aec288">EndElement</a>(<span class="keyword">const</span> <span class="keywordtype">char</span>* tagName); <a name="l00085"></a>00085 <span class="keywordtype">void</span> FinishedParsing(); <a name="l00086"></a>00086 <a name="l00087"></a><a class="code" href="a00477.html#60cd967a8085de226967c465f7bf61bb">00087</a> <span class="keyword">const</span> <span class="keywordtype">char</span>* GetValue(<span class="keyword">const</span> <span class="keywordtype">char</span>* attr,<span class="keyword">const</span> <span class="keywordtype">char</span>** attrs) <a name="l00088"></a>00088 { <a name="l00089"></a>00089 <span class="keywordtype">int</span> i; <a name="l00090"></a>00090 <span class="keywordflow">for</span> (i=0;attrs[i];i+=2) <a name="l00091"></a>00091 { <a name="l00092"></a>00092 <span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210c713735f1d46c2694d66e85217207be2">name</a>=strrchr(attrs[i],<span class="charliteral">':'</span>); <a name="l00093"></a>00093 <span class="keywordflow">if</span> (!name) <a name="l00094"></a>00094 { <a name="l00095"></a>00095 name=attrs[i]; <a name="l00096"></a>00096 } <a name="l00097"></a>00097 <span class="keywordflow">else</span> <a name="l00098"></a>00098 { <a name="l00099"></a>00099 name++; <a name="l00100"></a>00100 } <a name="l00101"></a>00101 <span class="keywordflow">if</span> (strcmp(attr,name)==0) <a name="l00102"></a>00102 { <a name="l00103"></a>00103 <span class="keywordflow">return</span> attrs[i+1]; <a name="l00104"></a>00104 } <a name="l00105"></a>00105 } <a name="l00106"></a>00106 <span class="keywordflow">return</span> NULL; <a name="l00107"></a>00107 } <a name="l00108"></a>00108 <a name="l00109"></a>00109 <span class="comment">// Convenience methods to add vertices/edges to the SIL.</span> <a name="l00110"></a>00110 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> AddVertexToSIL(<span class="keyword">const</span> <span class="keywordtype">char</span>* <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210c713735f1d46c2694d66e85217207be2">name</a>); <a name="l00111"></a>00111 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> AddChildEdgeToSIL(<a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> src, <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> dst); <a name="l00112"></a>00112 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> AddCrossEdgeToSIL(<a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> src, <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> dst); <a name="l00113"></a>00113 <a name="l00117"></a>00117 <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> GetPartVertex(<span class="keyword">const</span> <span class="keywordtype">char</span>* part_number_instance_string); <a name="l00118"></a>00118 <a name="l00119"></a>00119 <span class="comment">// For each of the blocks, this maps the "id" attribute in the XML to the</span> <a name="l00120"></a>00120 <span class="comment">// vertex id for the block in the SIL.</span> <a name="l00121"></a><a class="code" href="a00477.html#15f8cb266535abd4f0b1e251b54b7fc3">00121</a> vtkstd::map<int, vtkIdType> BlockID_To_VertexID; <a name="l00122"></a>00122 <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="comment">// Maps block "id"s to material names.</span> <a name="l00125"></a><a class="code" href="a00477.html#6fa4aa267c90f979ad570517e2064d28">00125</a> vtkstd::map<int, vtkstd::string> BlockID_To_MaterialName; <a name="l00126"></a>00126 <a name="l00127"></a>00127 <span class="comment">// Maps material name to vertex id.</span> <a name="l00128"></a>00128 <span class="comment">// This will be build only if <material-list> is present in the XML.</span> <a name="l00129"></a><a class="code" href="a00477.html#8b1e1d6ddb3b9653c82747599b1b7e4f">00129</a> vtkstd::map<vtkstd::string, vtkIdType> MaterialName_To_VertexID; <a name="l00130"></a>00130 <a name="l00131"></a><a class="code" href="a00477.html#d68f2cbdd5b235350dff06917564436e">00131</a> vtkstd::map<vtkIdType, vtkstd::string> PartVertexID_To_Descriptions; <a name="l00132"></a>00132 <a name="l00133"></a>00133 <span class="comment">// These save the values read from <material-specification /> element present</span> <a name="l00134"></a>00134 <span class="comment">// withint the <part /> elements.</span> <a name="l00135"></a>00135 <span class="comment">// key: part vertex id</span> <a name="l00136"></a>00136 <span class="comment">// value: material name = (desp + spec)</span> <a name="l00137"></a><a class="code" href="a00477.html#16d725284c42d534a8d5a7b5d7bf5bef">00137</a> vtkstd::map<vtkIdType, vtkstd::string> MaterialSpecifications; <a name="l00138"></a>00138 <a name="l00139"></a>00139 <span class="comment">// Maps the "{part-number} Instance: {part-instance}" key for the vertex id</span> <a name="l00140"></a>00140 <span class="comment">// for the part vertex in the Assemblies hierarchy.</span> <a name="l00141"></a><a class="code" href="a00477.html#8063db7d7cbdd8399fb3d32d5922e260">00141</a> vtkstd::map<vtkstd::string, vtkIdType> Part_To_VertexID; <a name="l00142"></a>00142 <a name="l00143"></a>00143 <span class="comment">// Maps a block-id to the "{part-number} Instance: {part-instance}" string.</span> <a name="l00144"></a><a class="code" href="a00477.html#746ed0dfcd7d29b6c348479832e041fe">00144</a> vtkstd::map<int, vtkstd::string> BlockID_To_Part; <a name="l00145"></a>00145 <a name="l00146"></a><a class="code" href="a00477.html#9f73e5341a69b5137db6cd38ff376e7e">00146</a> <a class="code" href="a01071.html" title="An editable directed graph.">vtkMutableDirectedGraph</a>* SIL; <a name="l00147"></a><a class="code" href="a00477.html#a5c6f620f448ebc97d1906b2778ca82a">00147</a> <a class="code" href="a01562.html" title="Hold a reference to a vtkObjectBase instance.">vtkSmartPointer<vtkStringArray></a> NamesArray; <a name="l00148"></a><a class="code" href="a00477.html#915a7d6480fd401c9820e2ab8009315f">00148</a> <a class="code" href="a01562.html" title="Hold a reference to a vtkObjectBase instance.">vtkSmartPointer<vtkUnsignedCharArray></a> CrossEdgesArray; <a name="l00149"></a>00149 <a name="l00150"></a><a class="code" href="a00477.html#5578af58f8e82aef4a72257e6ce4d7e3">00150</a> <a class="code" href="a03761.html#c6551f7bf833e8254b2b3ecdaea0d210ff2af282e340f7884417cb571d333ccc">vtkstd::string</a> BlockPartNumberString; <a name="l00151"></a>00151 <a name="l00152"></a><a class="code" href="a00477.html#06f7366328d8b543dfddfdd69698b95b">00152</a> <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> RootVertex; <a name="l00153"></a><a class="code" href="a00477.html#fca2fd97c68889cb1f3837908ed2434c">00153</a> <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> BlocksVertex; <a name="l00154"></a><a class="code" href="a00477.html#0f7241d3f81dd28fc9e634856b772325">00154</a> <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> AssembliesVertex; <a name="l00155"></a><a class="code" href="a00477.html#7b19a492501ff118733a694df2acd224">00155</a> <a class="code" href="a02149.html#20bd6b6dedfe1bbb096c50354d52cc7e">vtkIdType</a> MaterialsVertex; <a name="l00156"></a><a class="code" href="a00477.html#c3d1f332ffe0129caf8ec9fc1adc952d">00156</a> vtkstd::vector<vtkIdType> CurrentVertex; <a name="l00157"></a>00157 <a name="l00158"></a><a class="code" href="a00477.html#d3768f6a9b43875d322a4c1b3e2ff883">00158</a> <span class="keywordtype">bool</span> InBlocks; <a name="l00159"></a><a class="code" href="a00477.html#6c7334dc6b0fcaf78b6cd1553821cbde">00159</a> <span class="keywordtype">bool</span> InMaterialAssignments; <a name="l00160"></a>00160 <a name="l00161"></a>00161 <span class="keyword">private</span>: <a name="l00162"></a>00162 <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>(<span class="keyword">const</span> <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>&); <span class="comment">// Not implemented</span> <a name="l00163"></a>00163 <span class="keywordtype">void</span> operator=(<span class="keyword">const</span> <a class="code" href="a00477.html" title="internal parser used by vtkExodusIIReader.">vtkExodusIIReaderParser</a>&); <span class="comment">// Not implemented</span> <a name="l00164"></a>00164 <span class="comment">//ETX</span> <a name="l00165"></a>00165 }; <a name="l00166"></a>00166 <a name="l00167"></a>00167 <span class="preprocessor">#endif</span> <a name="l00168"></a>00168 <span class="preprocessor"></span> </pre></div></div> <hr size="1"><address style="text-align: right;"><small>Generated on Wed Jun 3 18:35:32 2009 for VTK by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6 </small></address> </body> </html>