Example 242: 2D Geometric fitting using cubic Hermite elements

This example tests 2D geometry fitting by optimisation using cubic Hermite elements.


The comfile run by this example is as follows:

#Example_242 Geometric fitting using optimisation of cubic Hermite elements
                                                                    
fem                            #sets the environment to FEM         
fem define node;r;2doptifitting;example #Read in the initial mesh nodes
fem define base;r;;example         #Define a cubic Hermite basis function
fem define element;r;;example      #Define the elements
fem define data;r;;example         #Define the data point positions
fem define window;c            #Calculate the window size
fem draw data                  #Draw the data
fem draw nodes                 #Draw the initial node positions
fem draw line                  #Draw the initial mesh
#                              !  mesh
# Iteration 1
#
fem define xi;c orthogonal     #Calculate the orthogonal data point projection
#                              !  Xi locations.
fem draw data projection       #Draw the data point projections
fem draw data trace            #Draw the data point Xi locations
fem define fit;r;;example optimisation #Define a fitting by optimisation problem
fem define optimise;r;;example     #Define the optimisation problem
# list optimise tries to write out residuals but they are uninitialised as
# they haven't been calculated yet.
# fem list optimise              #List the optimisation problem.
fem list node                  #List the initial nodal positions. Note that
#                              !  the initial mesh does not have arc-length
#                              !  derivatives (i.e. the derivative vector
#                              !  does not have length 1.)
fem list data error            #List the error in the data points from the 
#
optimise                       #Solve the optimisation problem
fem update scale_factor        #Recalculate the scale factors to be average
#                              !  arc-length
fem draw line                  #Draw the fitted mesh
fem draw node                  #Draw the fitted node positions
#                              !  mesh
# Iteration 2
#
fem define xi;c orthogonal     #Calculate the new data point projections 
fem draw data projection       #Draw the new data point projections
fem hide data trace            #Hide the old data point Xi locations
fem list data error            #List the new data point error
fem define opti;r;;example         #Redefine the new optimisation problem
# fem list optimise              #List the optimisation problem
fem list node                  #List the nodal positions. Note that after the
#                              !  fit we now have arc-length derivatives (the
#                              !  nodal arc-length vector has magnitude 1).
optimise                       #Solve the optimisation problem 
fem update scale_factor        #Recalculate the scale factors to be average
fem draw line                  #Draw the fitted mesh
fem draw node                  #Draw the fitted node positions
#                              !  mesh
# Iteration 3
#
fem define xi;c orthogonal     #Calculate the new data point projections 
fem draw data projection       #Draw the new data point projections
fem define opti;r;;example         #Redefine the new optimisation problem
fem list data error            #List the new data point error
optimise                       #Solve the optimisation problem
fem update scale_factor        #Recalculate the scale factors to be average
fem draw line                  #Draw the fitted mesh
fem draw node                  #Draw the fitted node positions
fem define xi;c orthogonal     #Calculate the new data point projections 
fem draw data projection       #Draw the new data point projections
fem list data error            #List the new data point error
#
# More iterations if neccassary ...
#

Additional testing commands:

fem list node
fem list element
fem list optimise

Files used by this example are:

Name                  Modified     Size

example_242.com 23-Oct-2003 3.7k 2doptifitting.ipbase 10-Apr-2000 1.2k 2doptifitting.ipdata 10-Apr-2000 1.9k 2doptifitting.ipelem 10-Apr-2000 1.3k 2doptifitting.ipfit 10-Apr-2000 209 2doptifitting.ipnode 10-Apr-2000 1.8k 2doptifitting.ipopti 19-Mar-2002 1.7k 2doptifitting.ipxi 10-Apr-2000 1.0k test_output.com 10-Apr-2000 49

Download the entire example:

Name                      Modified     Size

examples_2_24_242.tar.gz 19-Aug-2006 6.9k

Testing status by version:

StatusTestedReal time (s)
i686-linux
cmSuccessSun Mar 6 00:01:41 20161
cm-debugSuccessSat Mar 5 00:01:58 20160
mips-irix
cmSuccessSun Aug 19 01:31:50 20075
cm-debugSuccessWed Aug 15 01:28:36 200710
cm-debug-clear-mallocSuccessSat Aug 18 01:31:28 200714
cm-debug-clear-malloc7SuccessMon Aug 20 01:27:58 200713
cm64SuccessSun Aug 19 01:31:54 20075
cm64-debugSuccessTue Aug 21 01:25:02 200710
cm64-debug-clear-mallocSuccessThu Apr 1 10:12:13 20044
rs6000-aix
cmSuccessWed Mar 4 01:06:54 20090
cm-debugSuccessMon Mar 2 01:06:53 20092
cm64SuccessWed Mar 4 01:06:54 20090
cm64-debugSuccessTue Mar 3 01:12:06 20092
x86_64-linux
cmSuccessSun Mar 6 00:01:01 20160
cm-debugSuccessSat Mar 5 00:01:12 20160

Testing status by file:


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

Input last modified: Thu Oct 23 13:58:04 2003


CMISS Help / Examples / 2 / 24 / 242