Difference between revisions of "XMLData Command"
m |
|||
(16 intermediate revisions by one other user not shown) | |||
Line 18: | Line 18: | ||
* <tt>(section)</tt> indicates the section where the XML data will be inserted (if it is omitted, it is set to "End"). The possible sections are: | * <tt>(section)</tt> indicates the section where the XML data will be inserted (if it is omitted, it is set to "End"). The possible sections are: | ||
** "Header" to insert at the end of the <tt><Header></tt> section. | ** "Header" to insert at the end of the <tt><Header></tt> section. | ||
** "MPMHeader" to insert at the end of the <tt><MPMHeader></tt> section (MPM Only). | ** "MPMHeader" to insert at the end of the <tt><MPMHeader></tt> section (MPM Only). | ||
** "Mesh" to insert at the end of the <tt><Mesh></tt> section. | ** "Mesh" to insert at the end of the <tt><Mesh></tt> section. | ||
** "MaterialPoints" to insert in the <tt><MaterialPoints></tt> definition section. It may be interspersed with Region, Hole, and BMPRegion commands | ** "MaterialPoints" to insert in the <tt><MaterialPoints></tt> definition section of MPM files or with shape commands in FEA files to define the mesh. It may be interspersed with Region, Hole, and BMPRegion commands. | ||
** " | ** "Material" to insert a custom material along with other materials. Each insertion for this section must define a single [[Material Models|material]] (see [[#Notes|below]]) | ||
** "GridBCs" to insert in the <tt><GridBCs></tt> section. it may be interspersed with | ** "GridBCs" to insert in the <tt><GridBCs></tt> section. it may be interspersed with other grid boundary conditions. | ||
** "ParticleBCs" to insert in the <tt><ParticleBCs></tt> section. it may be interspersed with | ** "ParticleBCs" to insert in the <tt><ParticleBCs></tt> section. it may be interspersed with other particle boundary conditions (MPM Only). | ||
** "Thermal" to insert at the end of the <tt><Thermal></tt> section. | ** "Thermal" to insert at the end of the <tt><Thermal></tt> section. | ||
** "CustomTasks" to insert at the end of the <tt><CustomTasks></tt> section. | |||
** "End" to insert at the end of all other <tt>XML</tt> data. | ** "End" to insert at the end of all other <tt>XML</tt> data. | ||
* <tt>( | * <tt>(matid)</tt> specifies a material ID, but is only used when <tt>(section)</tt> is "Materials" (see [[#Notes|below]]) | ||
The <tt>XML</tt> data that is inserted will be all lines between the XMLData command and the EndXMLData Command. You can have | The <tt>XML</tt> data that is inserted will be all lines between the <tt>XMLData</tt> command and the <tt>EndXMLData</tt> Command. You can have multiple <tt>XMLData</tt> blocks for each section and subsequent blocks will be appended to previous blocks for each section. | ||
<font color="red">Caution:</font> - all lines are inserted verbatim. If the block contains [[Expression Syntax|expressions]], they will not be evaluated, but just inserted as the expression text. You can avoid this limitation, however, by using an [[Expression Syntax|expression]] to define an [[Entity Command|entity]] and then using that entity in the verbatim <tt>XML</tt> code. Similarly, if you comment out a line using the [[Command Line Syntax#Comment Line|scripting language comment method]], that line will still be inserted with the verbatim <tt>XML</tt>. If you want to comment the <tt>XML</tt> code (or comment out lines in that code), you can use the <tt>XML</tt> comment method of <tt><!-- an XML comment --></tt> instead. | |||
== Notes == | == Notes == | ||
Line 36: | Line 38: | ||
<ol> | <ol> | ||
<li>Each insertion into " | <li>Each insertion into "Material" must define a single [[Material Command Block|<tt>Material</tt> command block]]: | ||
<pre><Material Type="20" Name="New Material"> | <pre><Material Type="20" Name="New Material"> | ||
(property commands) | (property commands) | ||
</Material> | </Material> | ||
</pre> | </pre> | ||
where the property commands set the material properties. The second <tt>(matid)</tt> parameter to the <tt>XMLData</tt> command must be provided and it must have a unique material ID (which can be used like regular material IDs). This insertion option is provided to work with materials in the code engines that are not yet supported by [[NairnFEAMPM]] or [[NairnFEAMPMViz]]. | where the property commands set the material properties. The second <tt>(matid)</tt> parameter to the <tt>XMLData</tt> command must be provided and it must have a unique [[Material Command Block|material ID]] (which can be used like regular material IDs). This insertion option is provided to work with [[Material Models|materials]] in the code engines that are not yet supported by [[NairnFEAMPM]] or [[NairnFEAMPMViz]], such a new [[Material Models|materials]] currently in development. | ||
<li>For "MaterialPoints", "Materials, "GridBCs", and "ParticleBCs", the data will be inserted when the <tt>XMLData</tt> command is used. This approach allows you to intersperse <tt>XML</tt> features with scripted features in these sections. For other sections the <tt>XML</tt> is inserted at the end each section. | |||
<li> | <li>Another command to insert raw <tt>XML</tt> data is the [[Entity Command]]. | ||
</ol> | </ol> |
Latest revision as of 15:13, 25 January 2019
The XMLData command inserts raw XML data into command-interpretation results.
Introduction
As the NairnMPM and NairnFEA code engines develop, they sometimes add new features that cannot be used with the current script commands. Rather than wait for new scripting commands or reverting to using XML input files, the XMLData command lets you insert raw XML data needed to try the new features.
XMLData Command
The XMLData command allows you to insert XML commands into the interpretation results. The format is:
XMLData <(section)>,<(matid)> <tag> Inserted xml characters </tag> EndXMLData
where
- (section) indicates the section where the XML data will be inserted (if it is omitted, it is set to "End"). The possible sections are:
- "Header" to insert at the end of the <Header> section.
- "MPMHeader" to insert at the end of the <MPMHeader> section (MPM Only).
- "Mesh" to insert at the end of the <Mesh> section.
- "MaterialPoints" to insert in the <MaterialPoints> definition section of MPM files or with shape commands in FEA files to define the mesh. It may be interspersed with Region, Hole, and BMPRegion commands.
- "Material" to insert a custom material along with other materials. Each insertion for this section must define a single material (see below)
- "GridBCs" to insert in the <GridBCs> section. it may be interspersed with other grid boundary conditions.
- "ParticleBCs" to insert in the <ParticleBCs> section. it may be interspersed with other particle boundary conditions (MPM Only).
- "Thermal" to insert at the end of the <Thermal> section.
- "CustomTasks" to insert at the end of the <CustomTasks> section.
- "End" to insert at the end of all other XML data.
- (matid) specifies a material ID, but is only used when (section) is "Materials" (see below)
The XML data that is inserted will be all lines between the XMLData command and the EndXMLData Command. You can have multiple XMLData blocks for each section and subsequent blocks will be appended to previous blocks for each section.
Caution: - all lines are inserted verbatim. If the block contains expressions, they will not be evaluated, but just inserted as the expression text. You can avoid this limitation, however, by using an expression to define an entity and then using that entity in the verbatim XML code. Similarly, if you comment out a line using the scripting language comment method, that line will still be inserted with the verbatim XML. If you want to comment the XML code (or comment out lines in that code), you can use the XML comment method of <!-- an XML comment --> instead.
Notes
- Each insertion into "Material" must define a single Material command block:
<Material Type="20" Name="New Material"> (property commands) </Material>
where the property commands set the material properties. The second (matid) parameter to the XMLData command must be provided and it must have a unique material ID (which can be used like regular material IDs). This insertion option is provided to work with materials in the code engines that are not yet supported by NairnFEAMPM or NairnFEAMPMViz, such a new materials currently in development.
- For "MaterialPoints", "Materials, "GridBCs", and "ParticleBCs", the data will be inserted when the XMLData command is used. This approach allows you to intersperse XML features with scripted features in these sections. For other sections the XML is inserted at the end each section.
- Another command to insert raw XML data is the Entity Command.