Example a/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/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 17-Mar-2014 4.2k COPYRIGHT 17-Mar-2014 504 block.exelem 30-Mar-2015 4.6k block.exnode 17-Mar-2014 681 block_grid.exelem 17-Mar-2014 2.9k

Download the entire example:

Name                              Modified     Size

examples_a_exelem_formats.tar.gz 09-Mar-2016 93k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxFailureSun Mar 6 00:05:35 20160
last breakTue Mar 31 00:08:00 20151
cmgui-wx-debugFailureSun Mar 6 00:05:35 20160
last breakTue Mar 31 00:08:00 20151
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:05:36 20161
last breakTue Mar 31 00:08:00 20151
cmgui-wx-debug-valgrindFailureSun Mar 6 00:27:13 201614
last breakSun Mar 6 00:26:00 201614
x86_64-linux
cmgui-wxFailureSun Mar 6 00:01:30 20161
last breakThu Apr 2 00:18:00 20151
cmgui-wx-debugFailureSun Mar 6 00:01:30 20160
last breakThu Apr 2 00:18:00 20151
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:30 20160
last breakThu Apr 2 00:18:00 20151
cmgui-wx-debug-valgrindFailureSun Mar 6 00:03:26 201611
last breakSun Mar 6 00:03:00 201611
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:54 20169

Testing status by file:


Html last generated: Wed Mar 9 16:02:02 2016

Input last modified: Wed Mar 9 15:49:34 2016


CMISS Help / Examples / a / exelem_formats