Example a_backup/exelem_formats: Special .exelem formats for grid, constant and indexed fields

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.

Screenshot of example a_backup/exelem_formats


The comfile run by this example is as follows:

# ***** 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;
}

}

Files used by this example are:

Name                Modified     Size

exelem_formats.com 20-Apr-2012 4.2k COPYRIGHT 20-Apr-2012 504 block.exelem 20-Apr-2012 4.2k block.exnode 20-Apr-2012 681 block_grid.exelem 20-Apr-2012 2.9k

Download the entire example:

Name                                     Modified     Size

examples_a_backup_exelem_formats.tar.gz 12-Aug-2014 93k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxSuccessSun Mar 6 00:06:28 20160
cmgui-wx-debugSuccessSun Mar 6 00:06:29 20160
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:06:29 20161
cmgui-wx-debug-valgrindSuccessSun Mar 6 00:31:06 201614
x86_64-linux
cmgui-wxSuccessThu Jan 7 00:01:27 20160
cmgui-wx-debugSuccessThu Jan 7 00:01:27 20160
cmgui-wx-debug-memorycheckSuccessThu Jan 7 00:01:28 20160
cmgui-wx-debug-valgrindFailureSun Mar 6 00:03:46 201613
last breakSun Mar 6 00:03:00 201613
last successWed Jun 3 00:13:00 201513
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:04:03 201612

Testing status by file:


Html last generated: Sun Mar 6 05:50:56 2016

Input last modified: Thu Oct 11 23:53:00 2012


CMISS Help / Examples / a_backup / exelem_formats