Tests shapes, bases and calculating faces for the mean 3-D element shapes and basis functions.
# ***** 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 Element Types 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 *****
# Tests element types by
# - reading in a variety of element shapes and bases
# - calculating the faces and lines
# - re-exporting the nodes and elements
# - specifing graphical element, face and line representations
# - exporting the vrml
# Set up some materials
gfx create material blue ambient 0.2 0.2 1 diffuse 0.2 0.2 1 emission 0 0 0 specular 0 0 0 alpha 1 shininess 0 texture none;
gfx create material bluey ambient 0 0.25 0.5 diffuse 0 0.4 1 emission 0 0 0 specular 0.5 0.5 0.5 alpha 1 shininess 0.3 texture none;
gfx create material gold ambient 1 0.4 0 diffuse 1 0.7 0 emission 0 0 0 specular 0.5 0.5 0.5 alpha 1 shininess 0.8 texture none;
gfx create material orange ambient 0.9 0.2 0 diffuse 0.9 0.2 0 emission 0 0 0 specular 0 0 0 alpha 1 shininess 0 texture none;
# Need emission so that the wireframe faces show up in vrml
gfx create material purple ambient 0 0 0 diffuse 0.55 0.35 1 emission 0.55 0.35 1 specular 0.5 0.5 0.5 alpha 1 shininess 0.5 texture none;
gfx create material silver ambient 0.4 0.4 0.4 diffuse 0.7 0.7 0.7 emission 0 0 0 specular 0.7 0.7 0.7 alpha 1 shininess 0.6 texture none;
# Create and draw axes.
gfx modify g_element "/" point glyph axes_xyz general size "0.5*0.5*0.5" select_on material blue selected_material default;
# Read nodes and elements
gfx read nodes $example/element_types.exnode;
gfx read elements $example/element_types.exelem;
@groups = ("simplex_simplex_linear","polygon_polygon_linear","simplex_linear_simplex","polygon_linear_polygon","linear_simplex_simplex","linear_polygon_polygon","simplex_simplex_cubic","polygon_polygon_cubic","simplex_cubic_simplex","polygon_cubic_polygon","cubic_simplex_simplex","cubic_polygon_polygon","cubic_cubic_cubic","cubic_cubic_linear","cubic_linear_cubic","linear_cubic_cubic","simplex_simplex_simplex","quadratic_simplex_simplex_simplex");
for $group (@groups)
{
# Calculate the faces and lines
gfx define face egroup $group;
# Set up graphical rendition.
$discretization = "4*4*2";
if ($group =~ /quadratic_simplex_simplex_simplex/)
{
$discretization = "4*4*4";
}
gfx modify g_element $group general clear circle_discretization 6 element_discretization $discretization native_discretization none;
gfx modify g_element $group cylinders constant_radius 0.006 select_on material silver selected_material default_selected;
gfx modify g_element $group surfaces select_on material purple selected_material default_selected render_wireframe;
gfx modify g_element $group element_points glyph diamond general size "0.02*0.02*0.02" centre 0,0,0 use_elements cell_corners discretization "4*4*2" native_discretization NONE select_on material gold selected_material default_selected;
gfx modify g_element $group element_points glyph diamond general size "0.02*0.02*0.02" centre 0,0,0 use_elements cell_centres discretization "4*4*2" native_discretization NONE select_on material bluey selected_material default_selected;
}
if ($TESTING) {
# test writing and re-reading all the element types
gfx write elements nodes non_recursive output_element_types.exelem;
gfx read elements output_element_types.exelem;
# test output the graphics to VRML
gfx export vrml file element_types.wrl;
} else {
gfx create window 1;
}