Introduction#

Programming examples#

The following sections show code pieces which are actually from the Z-mat and Z-set source code. We present these programming examples as they are in order to form a base for simple copy-paste starting for user-programming. All class names have been changed with an added _DEMO suffix in order that their generated symbols will not be overridden by the symbols in the standard Z-set libraries. The keywords are however the same, and these models will override what exists in the standard distribution.

These source files can be added to the $Z7PATH/User-project project directory (if they are not already there, use the material subdirectory for Z-mat extensions, and the finite_element subdirectory for Z-set add-ons) and the “user project” recompiled to make the plug-ins. To update the makefile adding new files, either run Zsetup on Linux or double click the proj.zpr file on Windows. In Linux then simply type Zmake, or on Windows open up the zfem_user.dsw Visual Studio project file to build.

Example compilation#

The following is a typical output when compiling the user project. The plug-in object files libZmat_ut_Linux.so and libZfem_ut_Linux.so are copied into the $Z7PATH/PUBLIC/lib-$Z7MACHINE directory where they are automatically searched for when running Zrun or Zmat.

$ Zsetup

===========================================
  Z-set 9.1.6     automatic configuration
  Zsetup               version 10/20/2002

  * use the file: library_files to select
    debug files and personal libraries
===========================================

  ..


$ Zmake

===========================================
  ZeBuLoN C++  9.1.6        Mode optimize
  Making executable
-------------------------------------------
  Making directory: o_Linux_64 for objects
  Objects in directory: o_Linux_64
  Z7PATH: /home/ZSET/Z9.1
===========================================
ZebFront src/Radial_return_plasticity.z -o src/Radial_return_plasticity.c

g++ -c  -std=c++11 -Wall -O6 -rdynamic -fPIC -DIcc  -DLinux -DLinux_64 -D_REENTRANT
-finline-functions -ffast-math -D__Zver=90106 -D__ZverMaj=9 -D__ZverMin=1 -D__ZverX=6
-L/home/ZSET/Z9.1/PUBLIC/lib-Linux_64 -I/home//ZSET/Z9.1/include  -w -Isrc  -o
o_Linux_64/Radial_return_plasticity.o src/Radial_return_plasticity.c if [ -f
o_Linux_64/Radial_return_plasticity.o ] ; then rm -f src/Radial_return_plasticity.c ; fi rm -f
libZmat_user.so rm -f ./.files-libZmat_user.so; Zlink -noalt   -o libZmat_user.so -f
./.files-libZmat_user.so Using file list : ./.files-libZmat_user.so

Linux_64 link with g++

Linking without blas

Linking using command: g++ -fPIC -rdynamic -shared -v -o libZmat_user.so
o_Linux_64/Radial_return_plasticity.o -L/home/Z9.1/PUBLIC/lib-Linux_64 -ldl

$