Difference between revisions of "Entity Command"

From OSUPDOCS
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 1: Line 1:
The <tt>Entity</tt> commands lets you insert <tt>XML</tt> entity definitions in the file and use then in selected commands.
The <tt>Entity</tt> commands lets you insert <tt>XML</tt> entity definitions in the file and use then in selected commands.
 
__TOC__
== Introduction ==
== Introduction ==


<tt>XML</tt> entities do not have much function when building and running calculations in [[NairnFEAMPM]] [[NairnFEAMPMViz]]. But perhaps you will use [[NairnFEAMPM]] or [[NairnFEAMPMViz]] just to set up calculations, create the <tt>XML</tt> input command, and then copy those file to a remote computer for running large calculations. After such calculations, you may need to modify the <tt>XML</tt> files remotely for new calculations using basic text editors or command line tools (like <tt>vi</tt>). For these situations, it is helpful to make use of entities in the <tt>XML</tt> files. The entities will be near the beginnin of the file (and therefore easy to edit) and can by throughout the file to control selected options of the simulations.
<tt>XML</tt> entities do not have much function when building and running calculations in [[NairnFEAMPM]] or [[NairnFEAMPMViz]]. But perhaps you will use [[NairnFEAMPM]] or [[NairnFEAMPMViz]] just to create the <tt>XML</tt> input commands and then copy those files to a remote computer for running large calculations. After such calculations, you may need to modify the <tt>XML</tt> files remotely for new calculations using basic text editors or command line tools (like <tt>vi</tt>). For these situations, it is helpful have entities in your <tt>XML</tt> files. The entities will be near the beginnin of the file (and therefore easy to edit) and they can be used throughout the file to control selected options of the simulations.


== Input Command ==
== Input Command ==


To create an <tt>XML</tt> to appear in automatically formatted input commands, use the command
To create an <tt>XML</tt> entity to appear in automatically-formatted input commands, use the command (which is for scripted files only):


  Entity (name),(value)
  Entity (name),(value)
Line 14: Line 14:


* <tt>(name)</tt> is the entity name without the leading ampersand (&amp;) or trailing semicolon (;) (''e.g,'' <tt>maxTime</tt> to refer to an <tt>XML</tt> entity <tt>&amp;maxtime;</tt>).
* <tt>(name)</tt> is the entity name without the leading ampersand (&amp;) or trailing semicolon (;) (''e.g,'' <tt>maxTime</tt> to refer to an <tt>XML</tt> entity <tt>&amp;maxtime;</tt>).
* <tt><value)</tt> is the setting for the entity to be inserted in the file.
* <tt>(value)</tt> is the setting for the entity to be inserted in the file.


All entities will appear in the <tt>DocType</tt> element at the start of the results <tt>XML</tt> commands. For example, the output would be:
All entities will appear in the <tt>DocType</tt> element at the start of the resulting <tt>XML</tt> commands. For example, the output could be:


  <?xml version='1.0'?>
  <?xml version='1.0'?>
Line 28: Line 28:
== Usage ==
== Usage ==


One entities are defined, you can use then in selected commands. For example, the [[MPM Methods and Simulation Timing#Input Commands|<tt>MaximumTime</tt> command]] will accept an entity. Each command that allows an entity will be document as accepting them. To use an entity, give the same name use in the <tt>Entity</tt> command (i.e., the entity name without the leading ampersand (&amp;) or trailing semicolon (;). The commands that accept entities are all commands intended to accept numerical values.
# Once entities are defined, you can use then in selected commands. For example, the [[MPM Methods and Simulation Timing#Input Commands|<tt>MaximumTime</tt> command]] will accept an entity to set the maximum time. Each command that allows an entity will be documented as accepting them. In commands that directly support entity use, you must provide the name as in the <tt>Entity</tt> command or without the leading ampersand (&amp;) and trailing semicolon (;).[[#Notes|<sup>1</sup>]] The commands that accept entities are all commands intended to accept numerical values.
# You can also use entities on most commands that expect string arguments such as the [[MPM Archiving Options#Scripted Input Files|<tt>Archive</tt> command]] or in place of any argument that can be a [[User Defined Functions|user-defined function]]. In this usage, the string you supply is simply used in place of the expected string and therefore you should always use the complete entity name including the leading ampersand (&amp;) and trailing semicolon (;).[[#Notes|<sup>1</sup>]] This usage works for many, but not all, commands that accept string arguments. When in doubt, you can test by providing an entity and then checking the resulting <tt>XML</tt> output to verify the entity was inserted as expected. In addition, the entity you provide is inserted without verifying you have actually defined that entity. It is your responsibility to make sure they are defined by <tt>Entity</tt> commands.
# The [[XMLData Command|XMLData command]] lets you insert verbatim <tt>XML</tt> code into commands files, but the verbatim text cannot include [[Expression Syntax|expressions]]. A work around is to define an entity using an <tt>Entity</tt> command with the expression and then use that entity in the verbatim <tt>XML</tt> code.
 
== Notes ==


You can also use entities on most commands that expect string arguments such as the [[MPM Archiving Option|Scripted Input Files|<tt>Archive</tt> command]] or any argument that can be a [[User Defined Functions|user-defined function.]]. In this usage, the string you supply is simply used in place of the expected string and therefore you should use the complete entity name including the leading ampersand (&amp;) and trailing semicolon (;). This usage works for many, but nor all, command that accept string arguments. When in doubt, you can test by providing an entity and then checking the results <tt>XML</tt> to verify the entity was inserted as expected. In addition, the entity you provide is inserted without verify you have actually defined that entity. It is your responbility to make sure they are defined.
# When using [[NairnFEAMPM]], entities provided with the leading ampersand (&amp;) and trailing semicolon (;) must be enclosed in quotes (''e.g''., <tt>"&amp;fxn;"</tt>). They do not need to be quoted when using [[NairnFEAMPMViz]].

Latest revision as of 09:53, 5 February 2014

The Entity commands lets you insert XML entity definitions in the file and use then in selected commands.

Introduction

XML entities do not have much function when building and running calculations in NairnFEAMPM or NairnFEAMPMViz. But perhaps you will use NairnFEAMPM or NairnFEAMPMViz just to create the XML input commands and then copy those files to a remote computer for running large calculations. After such calculations, you may need to modify the XML files remotely for new calculations using basic text editors or command line tools (like vi). For these situations, it is helpful have entities in your XML files. The entities will be near the beginnin of the file (and therefore easy to edit) and they can be used throughout the file to control selected options of the simulations.

Input Command

To create an XML entity to appear in automatically-formatted input commands, use the command (which is for scripted files only):

Entity (name),(value)

where

  • (name) is the entity name without the leading ampersand (&) or trailing semicolon (;) (e.g, maxTime to refer to an XML entity &maxtime;).
  • (value) is the setting for the entity to be inserted in the file.

All entities will appear in the DocType element at the start of the resulting XML commands. For example, the output could be:

<?xml version='1.0'?>
<!DOCTYPE JANFEAInput SYSTEM '/nairn-mpm-fea-OpenMP/NairnMPM/input/NairnMPM.dtd'
[
  <!ENTITY maxtime "7.5">
  <!ENTITY archPath "Results/MPM">
  <!ENTITY archTime "0.1">
]>

Usage

  1. Once entities are defined, you can use then in selected commands. For example, the MaximumTime command will accept an entity to set the maximum time. Each command that allows an entity will be documented as accepting them. In commands that directly support entity use, you must provide the name as in the Entity command or without the leading ampersand (&) and trailing semicolon (;).1 The commands that accept entities are all commands intended to accept numerical values.
  2. You can also use entities on most commands that expect string arguments such as the Archive command or in place of any argument that can be a user-defined function. In this usage, the string you supply is simply used in place of the expected string and therefore you should always use the complete entity name including the leading ampersand (&) and trailing semicolon (;).1 This usage works for many, but not all, commands that accept string arguments. When in doubt, you can test by providing an entity and then checking the resulting XML output to verify the entity was inserted as expected. In addition, the entity you provide is inserted without verifying you have actually defined that entity. It is your responsibility to make sure they are defined by Entity commands.
  3. The XMLData command lets you insert verbatim XML code into commands files, but the verbatim text cannot include expressions. A work around is to define an entity using an Entity command with the expression and then use that entity in the verbatim XML code.

Notes

  1. When using NairnFEAMPM, entities provided with the leading ampersand (&) and trailing semicolon (;) must be enclosed in quotes (e.g., "&fxn;"). They do not need to be quoted when using NairnFEAMPMViz.