mirror of
https://github.com/paboyle/Grid.git
synced 2025-04-25 05:05:56 +01:00
======================================== Visualisation of Grid / SciDAC format density fields using VTK (visualisation toolkit). Peter Boyle, 2025. ======================================== Uses: https://vtk.org Files are, for example, those produced by Grid/HMC/ComputeWilsonFlow.cc and Grid/HMC/site_plaquette.cc ======================================== Prerequisites: ======================================== 1) Install ffmpeg-7.0.2 (developer install, includes headers and libraries). MacOS note: must install ffmpeg from source -- homebrew only installs binaries. https://ffmpeg.org/download.html#releases Note: the latest ffmpeg (7.1.1) broke software compatibility with VTK. 2) Build and install VTK-9.4.2, with FFMEG support enabled. This is particularly involved on MacOS, so documented here. cd VTK-9.4.2 mkdir build cd build ccmake .. Using ccmake editor, set: FFMPEG_DIR /usr/local Toggle "advanced mode" (t) Set: CMAKE_EXE_LINKER_FLAGS CMAKE_MODULE_LINKER_FLAGS CMAKE_SHARED_LINKER_FLAGS each to: -framework Foundation -framework AudioToolbox -framework CoreAudio -liconv -lm -framework AVFoundation -framework CoreVideo -framework CoreMedia -framework CoreGraphics -framework AudioToolbox -framework OpenGL -framework OpenGL -framework VideoToolbox -framework CoreImage -framework AppKit -framework CoreFoundation -framework CoreServices -lz -lbz2 -Wl,-framework,CoreFoundation -Wl,-framework,Security -L/usr/local/lib -lavdevice -lavfilter -lavformat -lavcodec -lswresample -lswscale -lavutil Set paths for each of FFMPEG_DIR /usr/local FFMPEG_avcodec_INCLUDE_DIR /usr/local/include FFMPEG_avcodec_LIBRARY /usr/local/lib/libavcodec.a FFMPEG_avdevice_INCLUDE_DIR /usr/local/include FFMPEG_avdevice_LIBRARY /usr/local/lib/libavdevice.a FFMPEG_avfilter_INCLUDE_DIR /usr/local/include FFMPEG_avfilter_LIBRARY /usr/local/lib/libavfilter.a FFMPEG_avformat_INCLUDE_DIR /usr/local/include FFMPEG_avformat_LIBRARY /usr/local/lib/libavformat.a FFMPEG_avresample_INCLUDE_DIR /usr/local/include FFMPEG_avresample_LIBRARY /usr/local/lib/libavresample.a FFMPEG_avutil_INCLUDE_DIR /usr/local/include FFMPEG_avutil_LIBRARY /usr/local/lib/libavutil.a FFMPEG_swresample_INCLUDE_DIR /usr/local/include FFMPEG_swresample_LIBRARY /usr/local/lib/libswresample.a FFMPEG_swscale_INCLUDE_DIR /usr/local/include FFMPEG_swscale_LIBRARY /usr/local/lib/libswscale.a VTK_MODULE_ENABLE_VTK_IOFFMPEG YES VTK really should make it easier to pick up the flags required for FFMPEG linkage, especially as they are very quirky on MacOS. ======================================== Grid: ======================================== 3) Build and install a version of Grid 4) Ensure "grid-config" is in your path. 5) cd Grid/visualisation/ libs=`grid-config --libs` ldflags=`grid-config --ldflags` cxxflags=`grid-config --cxxflags` cxx=`grid-config --cxx` mkdir build cd build LDFLAGS="$ldflags $libs " cmake .. -DCMAKE_CXX_COMPILER=$cxx -DCMAKE_CXX_FLAGS=$cxxflags make 6) Invoke as: FieldDensityAnimate --isosurface <float-from-0-to-5> --grid X.Y.Z.T --file1 SciDacDensityFile1 [--xlate] [--mpeg] FieldDensityAnimate --isosurface <float-from-0-to-5> --grid X.Y.Z.T --file1 SciDacDensityFile1 --file2 SciDacDensityFile2 [--xlate] [--mpeg] ================================== Extensions ================================== 7) Direct calling from Grid ?: Not yet implemented, but could develop sufficient interface to write a Lattice scalar field into MPEG direct from running code. 8) Example python code: FieldDensity.py . This is not interfaced to Grid.