/*!

\page cartesian_algo_page Body Fitting 3D meshing algorithm

Body Fitting algorithm generates hexahedrons of a Cartesian grid in
the internal part of geometry and polyhedrons and other types of
elements at the intersection of Cartesian cells with the geometrical
boundary.

\image html cartesian3D_sphere.png "A sphere meshed by Body Fitting algorithm"

The meshing algorithm is as follows.
<ol>
<li> Lines of a Cartesian structured grid defined by
\ref cartesian_hyp_anchor "Body Fitting Parameters" hypothesis are
intersected with the geometry boundary, thus nodes lying on the
boundary are found. This step also allows finding out for each node of
the Cartesian grid if it is inside or outside the geometry. </li>
<li> For each cell of the grid, check how many of its nodes are outside
of the geometry boundary. Depending on a result of this check
<ul>
<li> skip a cell, if all its nodes are outside </li>
<li> skip a cell, if it is too small according to <b> Size
    Threshold </b> parameter</li>
<li> add a hexahedron in the mesh, if all nodes are inside </li>
<li> add a polyhedron or another cell type in the mesh, if some
nodes are inside and some outside. </li> 
</ul>
</li>
</ol>
To apply this algorithm when you define your mesh, select <b>Body
  Fitting</b> in the list of 3D algorithms and add <b>Body Fitting
  Parameters</b> hypothesis. The following dialog will appear:

<br>
\anchor cartesian_hyp_anchor
<h2>Body Fitting Parameters hypothesis</h2>

\image html cartesian3D_hyp.png "Body Fitting Parameters hypothesis dialog"

This dialog allows to define
<ul>
  <li>\b Name of the algorithm. </li>
  <li> Minimal size of a cell truncated by the geometry boundary. If the
    size of a truncated grid cell is \b Threshold times less than a
    initial cell size, then a mesh element is not created. </li>
  <li> <b> Implement Edges </b> check-box activates incorporation of
  geometrical edges in the mesh.
  
\image html cartesian_implement_edge.png "Implement Edges switched off to the left and on to the right"

  <li> <b>Definition mode</b> allows choosing how Cartesian structured
  grid is defined. Location of nodes along each grid axis is defined
  individually:
    <ul>
      <li> You can specify the \b Coordinates of grid nodes. \b Insert button
        inserts a node at \b Step distance (negative or positive) from the
        selected node. \b Delete button removes the selected node. Double
        click on a coordinate in the list enables its edition. 
        \b Note that node coordinates are measured along directions of
        axes that can differ from the directions of the Global Coordinate
        System.</li>
      <li> You can define the \b Spacing of a grid as an algebraic formula
        <em>f(t)</em> where \a t is a position along a grid axis
        normalized at [0.0,1.0]. <em>f(t)</em> must be non-negative
        at 0. <= \a t <= 1. The whole extent of geometry can be
        divided into ranges with their own spacing formulas to apply;
        \a t varies between 0.0 and 1.0 within each \b Range. \b Insert button
        divides a selected range into two. \b Delete button adds the
        selected sub-range to the previous one. Double click on a range in
        the list enables edition of its right boundary. Double click on a
        function in the list enables its edition.
    </li> </ul>
  </li>
  
  <li> <b> Fixed Point</b> group allows defining an exact location of
  a grid node in the direction defined by spacing. The following cases
  are possible:
    <ul>
      <li>If all three directions are defined by spacing, there will
      be a mesh node at the <b> Fixed Point</b>. </li>
      <li>If two directions are defined by spacing, there will be at
      least a link between mesh nodes passing through the <b> Fixed
      Point</b>.</li> 
      <li> If only one direction is defined by spacing, there will be
      at least an element facet passing through the <b> Fixed
      Point</b>.</li>
      <li>If no directions are defined by spacing, <b> Fixed Point</b>
      is disabled.</li>
    </ul>
  </li>
	
  <li> <b> Directions of Axes</b> group allows setting the directions of grid axes.
    <ul>
      <li>If <b> Orthogonal Axes </b> check-box is activated the
        axes remain orthogonal during their modification. </li>
      <li> Selection buttons enable snapping corresponding axes to
        direction of a geometrical edge selected in the Object
        Browser. Edge direction is defined by coordinates of its end
        points.</li>
      <li><b> Optimal Axes</b> button runs an algorithm that tries to
        set the axes to maximize the number of generated hexahedra.</li>
      <li><b> Reset </b> button returns the axes in a default position
      parallel to the axes of the Global Coordinate System.</li> 
  </ul>
  </li>
 </ul>

<br>
<b>See Also</b> a sample TUI Script of a
\ref tui_cartesian_algo "Usage of Body Fitting algorithm".

*/