Reads in real and integer grid-based fields in a 2-element bicubic-linear
element mesh. Also defines constant and indexed fields over the elements, the
latter using the integer grid-based field as an index into a set of values,
thus reducing storage requirements when properties can be categorized by cell
type, material type etc. Indexed string fields are also demonstrated.
Also tests writing these special exelem formats.
See example a/element_constants for further exelem formats.
# ***** BEGIN LICENSE BLOCK *****
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
#
# The contents of this file are subject to the Mozilla Public License Version
# 1.1 (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
# http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS IS" basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
# for the specific language governing rights and limitations under the
# License.
#
# The Original Code is CMISS exelem formats example.
#
# The Initial Developer of the Original Code is
# Auckland Uniservices Ltd, Auckland, New Zealand.
# Portions created by the Initial Developer are Copyright (C) 2010
# the Initial Developer. All Rights Reserved.
#
# Alternatively, the contents of this file may be used under the terms of
# either the GNU General Public License Version 2 or later (the "GPL"), or
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
# in which case the provisions of the GPL or the LGPL are applicable instead
# of those above. If you wish to allow use of your version of this file only
# under the terms of either the GPL or the LGPL, and not to allow others to
# use your version of this file under the terms of the MPL, indicate your
# decision by deleting the provisions above and replace them with the notice
# and other provisions required by the GPL or the LGPL. If you do not delete
# the provisions above, a recipient may use your version of this file under
# the terms of any one of the MPL, the GPL or the LGPL.
#
# ***** END LICENSE BLOCK *****
# Set the default tessellation to use 10 segments in each element direction.
# This command does not exist on older versions of cmgui. It is safe to ignore errors.
gfx define tessellation default minimum_divisions "10" refinement_factors "1";
{
# This example reads in real and integer grid-based fields in a 2-element
# bicubic-linear element mesh. Also defines constant and indexed fields over
# the elements, the latter using the integer grid-based field as an index into
# a set of values, thus reducing storage requirements when properties can be
# categorized by cell type, material type etc. Indexed string fields are also
# demonstrated.
#
# This example is fictional, but shows the main features available with these
# extensions to element I/O and storage capability. The material_type field is
# a grid-based integer that has values of 1, 2 or 3 at grid points over the
# elements. The material_name field has three names indexed by this integer
# field - use it as a label field in the graphical element editor to get a more
# interesting description of the material_type.
# Read in the two element geometry
gfx read nodes example block.exnode;
gfx read elements example block.exelem;
# Read in the grid-based, constant and indexed fields
gfx read elements example block_grid.exelem;
# Visualise these special fields
gfx modify g_element block general clear;
gfx modify g_element block lines material default;
gfx modify g_element block element_points use_elements glyph arrow_line size "0*1*1" centre 0,0,0 label material_name orientation "magnetic field vector" scale_factors "1*0*0" no_select discretization "1*1*1" native_discretization material_type cell_corners material default data potential spectrum default;
gfx modify g_element block iso_surfaces iso_scalar potential iso_value 6.0 material default;
gfx modify g_element block node_points glyph point size "1*1*1" centre 0,0,0 select_on material default;
gfx modify spectrum default autorange;
if ($TESTING) {
# Test writing and reading the whole group
gfx write elements output_block.exelem group block;
gfx read elements output_block.exelem;
# Test writing and reading individual fields in the group
gfx write elements output_block_material_type.exelem group block field material_type;
gfx write elements output_block_material_name.exelem group block field material_name;
gfx read elements output_block_material_type.exelem;
gfx read elements output_block_material_name.exelem;
# Export the graphics
gfx export vrml file output_block.wrl;
} else {
gfx create window 1;
}
}