Example a_backup/a8: Deformation with time, morphing, timekeeper: incision in the eye

This example shows an incision in the cornea of the eye. The deformation of the eye as the cut grows is demonstrated using the time slider and morphing with old-style graphics commands.

Screenshot of example a_backup/a8


The comfile run by this example is as follows:

#Example_a8: Deformation with time, morphing, timekeeper: incision in the eye
#
# A large proportion of modelling problems involve the time change of some or
# all field quantities such as geometry, stress etc. Cmgui has several features
# to aid visualisation of such changing fields.
#
# This example looks at the the growth of a slit in the cornea of the eye. It
# starts with the cornea under pressure, which causes the cut to open. There are
# 11 node files describing the geometry over time, which are read in and
# viewed. Graphical element groups are used to create a simple animation of the
# incision, that  can be controlled with the time slider on the graphics window.
#
#----------
#
# Create some materials for use in this example.
gfx create material slit_lines ambient 0 0 0 diffuse 1 0 0
gfx create material slit ambient 0 0 0 diffuse 1 1 1
gfx create material nonslit ambient 0 0 0 diffuse 1 1 1
gfx create material optic_zone ambient 0 0 1 diffuse 0 0 1
#
# Read in the nodes and the three element groups: slit, nonslit and optic_zone.
# The nonslit group shows the cornea in its position before the slit appeared -
# it will not be shown in this example, but you may with to view it and the
# slitted state simultaneously.
gfx read nodes example pressurized.exnode time 0
gfx read elements example slit_field.exelem
gfx read elements example nonslit_field.exelem
gfx read elements example optic_zone_field.exelem
#
# Create a window and show the mesh in perspective.
gfx create window
gfx mod win 1 view perspective
#

# Clear graphics and increase the discretization for the elements that "wrap" around the whole eye
gfx modify g_element slit general clear
gfx modify g_element nonslit general clear element_discretization "50*8*8"
gfx modify g_element optic_zone general clear element_discretization "50*8*8"

# Show exterior surfaces on all groups, and exterior lines on the slit group.
gfx modify g_element slit lines exterior mat slit_lines
gfx modify g_element slit surfaces exterior mat slit
gfx modify g_element nonslit surfaces exterior mat nonslit
gfx modify g_element optic_zone surfaces exterior mat optic_zone

for ($i = 1 ; $i < 11 ; $i++)
  {
	 gfx read nodes example unzip$i.exnode time $i;
  }
#
# Note that the red lines become a little obscured by the white surfaces, giving
# them a dashed look. This artefact results from small differences in the depth
# calculated for lines and surfaces meaning that neither is completely in front
# of the other. CMGUI uses a workaround to improve the situation, that perturbes
# the lines a small distance toward the viewer:
gfx modify window 1 set perturb_lines
# This command is very useful for displaying outlines of elements over surfaces
# in finite element meshes. Note however that it can cause small visual
# artefacts where surfaces intersect, andyou can always return to normal line
# mode with the 'normal_lines' option of the above command.
#
# ANIMATING THE INCISION
#
# CMGUI uses an object called a "timekeeper" to control display and animation of
# time aware objects. At present, there is only one timekeeper called 'default'
# which you can control with the 'gfx timekeeper' set of commands.
# There is a graphical controller called the time_editor.
gfx create time_editor
#
# To play an animation of the incision in the eye, type:
gfx timekeeper default play minimum 0 maximum 10 swing
# The timekeeper will play backwards and forwards between the minimum and maximum
# values
#
# Note that you can still interact with the program while it is playing. Try
# changing your view of the part of the eye in the graphics window. Furthermore,
# the timekeeper will keep on playing past the times in the graphics objects, so
# you must stop it. At the same time, let us return to the first time:
gfx timekeeper default stop set_time 0
#
# Now play it back at three times the original speed:
gfx timekeeper default play speed 3
#
# ... and stop it at any time with:
gfx timekeeper default stop
#
# As a separate example, you may wish to look at the stress distribution in the
# cornea. Without doing any of the above commands, uncomment and try the
# following:
#gfx read nodes example unzip10_stress.exnode
#gfx read elements example unzip10_stress.exelem
#gfx mod g_e cornea general element_discretization 14*4
#gfx mod g_e cornea surfaces scalar general
#gfx mod spectrum default autorange
#
#----------
#

Files used by this example are:

Name                     Modified     Size

example_a8.com 20-Apr-2012 4.3k COPYRIGHT 19-Apr-2012 504 nonslit_field.exelem 20-Apr-2012 22k optic_zone_field.exelem 20-Apr-2012 8.9k pressurized.exnode 20-Apr-2012 7.8k slit_field.exelem 20-Apr-2012 38k unzip1.exnode 20-Apr-2012 7.8k unzip10.exnode 20-Apr-2012 7.8k unzip10_stress.exelem 20-Apr-2012 65k unzip10_stress.exnode 20-Apr-2012 11k unzip2.exnode 20-Apr-2012 7.8k unzip3.exnode 20-Apr-2012 7.8k unzip4.exnode 20-Apr-2012 7.8k unzip5.exnode 20-Apr-2012 7.8k unzip6.exnode 20-Apr-2012 7.8k unzip7.exnode 20-Apr-2012 7.8k unzip8.exnode 20-Apr-2012 7.8k unzip9.exnode 20-Apr-2012 7.8k

Download the entire example:

Name                         Modified     Size

examples_a_backup_a8.tar.gz 12-Aug-2014 133k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxSuccessSun Mar 6 00:13:35 20162
cmgui-wx-debugSuccessSun Mar 6 00:12:05 20162
cmgui-wx-debug-memorycheckSuccessSun Mar 6 00:16:03 20163
cmgui-wx-debug-valgrindFailureSun Mar 6 00:58:24 201636
last breakSun Mar 6 00:57:00 201636
last successTue Feb 10 00:48:00 201540
x86_64-linux
cmgui-wxFailureSun Mar 6 00:01:35 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:04:00 20151
cmgui-wx-debugFailureSun Mar 6 00:01:35 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:04:00 20151
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:35 20160
last breakSun Mar 6 00:01:00 20160
last successWed Jun 3 00:04:00 20150
cmgui-wx-debug-valgrindFailureSun Mar 6 00:03:02 201610
last breakSun Mar 6 00:02:00 201610
last successWed Jun 3 00:28:00 201532
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:12 20167

Testing status by file:


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

Input last modified: Fri Apr 20 15:55:53 2012


CMISS Help / Examples / a_backup / a8