Example ag: CM-CMGUI transfer (CMISS) example

This example shows transfering data between CM and CMGUI. The object, consisting of eight elements, is defined in the FEM environment and exported to cmgui to be viewed. Note: cmiss is both cm and cmgui.

Screenshot of example a/ag

The comfile run by this example is as follows:

# This example shows transfering files between CM and CMGUI. The object,
#  consisting of eight elements, is defined in the FEM environment
#  and then exported to cmgui to be viewed.
# Note: cmiss is both cm and cmgui.
# First set up the FEM environment.
# Next define rectangular cartesian coordinates in 3D.
fem def coord;r;cheese;example 
# Define a bicubic linear basis function and face basis functions.
#  (xi 1 and xi 2 directions are cubic Hermite, while xi 3 is linear). 
fem def bas;r;cheese;example 
# Define 32 nodes and specify derivatives.
fem def node;r;cheese;example 
# define eight elements.
fem def ele;r;cheese;example
# Define viewing windows in all three directions.
fem def win on xz
fem def win on yz
fem def win on xy
# Draw axes,lines and nodes.
fem draw axes 
fem draw lines
fem draw nodes
# Viewing a 3D object with a series of fixed 2D views can be tricky.
#  CMGUI lets you change the viewing direction, making it easier to
#  interpret the object. To do this, the nodes and elements have to
#  be exported so it can be read into the GFX environment.
# The "as" operator lets you name the object before it is exported.
# The name after the ";" is the name of the exported file, while the
#  extention is set depending on whether it is a node or element being
#  exported. the files created by the following commands are:
#  cheese.exnode and cheese.exelem respectively.
fem export node;cheese as cheese
fem export elem;cheese as cheese
# Now set up the GFX environment.
# Read in nodes and elements. 
gfx read node example cheese.exnode
gfx read elem example cheese.exelem
# Now create materials. axes will be used for the axes, while cheese 
#  will be used on the surface of the object. 
gfx create material axes ambient 0 0 1 diffuse 0 0 1
gfx create material cheese ambient 1 1 0 diffuse 1 1 0 specular 1 0 0
# Draw axes.
gfx create axes material axes length 0.4
gfx draw axes
# Create viewing window.
gfx create window 
# The curved lines in the view aren't very smooth. Change the element 
#  discretisation to be 8 in the xi 1 and xi 2 directions and one in 
#  the xi 3 direction.
gfx modify g_element cheese gen element_discretization "8*8*1"
# To view the fixed 2D views as in the FEM environment, with the
#  GFX view, change the layout from simple to free_ortho. 
# This can be done by clicking with the mouse on the layout button in 
#  the CMGUI graphics window, or by entering the following command.
gfx mod win 1 layout free_ortho
# The top left window is the view which can be changed, while the other
#  three views are the fixed 2D views seen in the FEM environment.
# Now change back to the initial layout.
gfx mod win 1 layout simple
# Now give the object a cheese-coloured surface.
gfx modify g_element cheese surface material cheese
# finally hide the element lines, to view the cheesil. 
gfx modify g_element cheese lines invisible

Files used by this example are:

Name            Modified     Size

example_ag.com 17-Mar-2014 2.8k COPYRIGHT 17-Mar-2014 504 cheese.exelem 17-Mar-2014 15k cheese.exnode 17-Mar-2014 10k cheese.ipbase 17-Mar-2014 6.0k cheese.ipcoor 17-Mar-2014 597 cheese.ipelem 17-Mar-2014 2.9k cheese.ipnode 17-Mar-2014 29k

Download the entire example:

Name                  Modified     Size

examples_a_ag.tar.gz 09-Mar-2016 76k

Testing status by version:

StatusTestedReal time (s)
cmgui-wxSuccessSun Mar 6 00:05:19 20160
cmgui-wx-debugSuccessSun Mar 6 00:05:19 20160
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:05:20 20161
cmgui-wx-debug-valgrindSuccessSun Mar 6 00:27:25 201614
cmgui-wxSuccessThu Jan 7 00:01:14 20160
cmgui-wx-debugSuccessThu Jan 7 00:01:14 20160
cmgui-wx-debug-memorycheckSuccessThu Jan 7 00:01:14 20160
cmgui-wx-debug-valgrindSuccessThu Jan 7 00:03:59 201611
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:50 201610

Testing status by file:

Html last generated: Wed Mar 9 16:01:19 2016

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

CMISS Help / Examples / a / ag