Example ak: Multicomponent spectrums and data

Shows the use of multicomponent spectrums and data on a cube.

Screenshot of example a/ak


The comfile run by this example is as follows:

#Example_ak: Multi component data and spectrums
#
#----------
#
#
gfx read nodes example cube.exnode
gfx read elements example cube.exelem
#
gfx cre win
gfx modify g_element cube general element_discretization "8*8*8"
#As well as displaying scalar fields spectrums can be used to display 
#multicomponent fields.  A simple example of this is choosing
#coordinates as the data field.
gfx mod g_e cube surfaces data coordinates spectrum default
#This displays a rainbow spectrum (the default) representing the x coordinate.
#but by creating a multicomponent spectrum we can view all three
#components at once.
gfx cre spectrum rgb clear
gfx modify spectrum rgb linear range 0 1 extend_above extend_below red colour_range 0 1 ambient diffuse component 1
gfx modify spectrum rgb linear range 0 1 extend_above extend_below green colour_range 0 1 ambient diffuse component 2
gfx modify spectrum rgb linear range 0 1 extend_above extend_below blue colour_range 0 1 ambient diffuse component 3
#The component numbers specify which of the data components that settings acts
#upon.  Each settings can only act on one component.  If data is not defined
#for a particular component then that settings is ignored.  Conversely if no
#settings in a spectrum uses a component in the data field then that
#component has been ignored, by using the default spectrum on coordinates we
#are ignoring the y and z coordinates which are components 2 and 3.
#
#Change the lines and surfaces to use our new multicomponent spectrum
#and the coordinates as data.
gfx mod g_e cube surfaces data coordinates spectrum rgb
gfx mod g_e cube lines data coordinates spectrum rgb
#Now you see a colour cube.
#Where x=y=z=0 the cube is black.
#Where x=1 and y=z=0 then you see red as it is applied to component 1.
#Where x=y=z=1 the cube is white, full saturation of red, green and blue.
#
#With the spectrum editor you can convieniently examine the different
#components making up your multicomponent spectrum.
gfx edit spectrum rgb
#By toggling the "visiblity" check boxes to the left of each settings
#item and applying these changes you can quickly turn off and on
#the individual components.
#
#This cube example also defined three scalar fields, potential,
#conductivity and temperature.  To view these with a multicomponent
#spectrum they must be combined into a single field.
gfx define field combine_pct composite potential conductivity temperature
#Rescale the spectrum
gfx mod spectrum rgb clear
gfx modify spectrum rgb linear range 0 50 extend_above extend_below red colour_range 0 1 ambient diffuse component 1
gfx modify spectrum rgb linear range 0.12654 0.29643 extend_above extend_below green colour_range 0 1 ambient diffuse component 2
gfx modify spectrum rgb linear range 20.0 20.3 extend_above extend_below blue colour_range 0 1 ambient diffuse component 3
gfx edit spectrum rgb
gfx mod g_e cube surfaces data combine_pct spectrum rgb
gfx mod g_e cube lines data combine_pct spectrum rgb
#
#Have a look at Example aj which uses multicomponent spectrums to show 
#the texture coordinates defined over the surface of the heart.
#
gfx
#
#----------------
#
#Displaying scalars: To show a scalar such as coordinates.x by choosing 
#the coordinate field as data and then using a spectrum that only 
#operates on the first component is wasteful of memory if that is all 
#you want to display because choosing the coordinate field as your data 
#means that all three components of the data field are stored at every 
#vertex.  If you only wanted to show the x component it is better to 
#define a single component field containing that value only and use that
#for your data. i.e.
#gfx define field coordinates.x component coordinates.x
#gfx mod g_e cube surfaces data coordinates.x spectrum default


Files used by this example are:

Name            Modified     Size

example_ak.com 17-Mar-2014 3.7k COPYRIGHT 17-Mar-2014 504 cube.exelem 17-Mar-2014 5.8k cube.exnode 17-Mar-2014 861

Download the entire example:

Name                  Modified     Size

examples_a_ak.tar.gz 09-Mar-2016 127k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmgui-wxFailureSun Mar 6 00:12:55 20161
last breakTue Feb 24 03:13:00 20151
cmgui-wx-debugFailureSun Mar 6 00:10:17 20162
last breakTue Feb 24 03:14:00 20152
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:10:18 20162
last breakTue Feb 24 03:10:00 20152
cmgui-wx-debug-valgrindFailureSun Mar 6 00:48:01 201632
last breakSun Mar 6 00:47:00 201632
x86_64-linux
cmgui-wxFailureSun Mar 6 00:01:28 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debugFailureSun Mar 6 00:01:27 20160
last breakSun Mar 6 00:01:00 20160
cmgui-wx-debug-memorycheckFailureSun Mar 6 00:01:28 20161
last breakSun Mar 6 00:01:00 20161
cmgui-wx-debug-valgrindFailureSun Mar 6 00:02:47 20169
last breakSun Mar 6 00:02:00 20169
cmgui-wx-gcc-cad-debug-valgrindSuccessThu Jan 7 00:02:24 20167

Testing status by file:


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

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


CMISS Help / Examples / a / ak