Leading the Trend in Scientific Computation… …using MATFOR® 1 AnCAD Incorporated Things You Must Know If You’re Thinking about Visualizing and Animating Your Simulation in Fortran and C++ Environments… 2 AnCAD Incorporated The Demands Are you keeping up with the trend of dynamic visualization? Do you know it can be done within a few lines of codes without any windows programming or graphics initialization? Over 70% of effort is wasted on post-processing. Are you looking into data processing at run-time? Lots of researchers are already using interactive movie presentation. Are you still presenting your work with static graphs? 3 - MATFOR®A Simple Yet Powerful Solution to Meet Your Needs! 4 AnCAD Incorporated What’s MATFOR® ? MATFOR® is a set of numerical and visualization libraries especially designed for programmers in scientific computing field. MATFOR® is a new generation graphics library fully exploiting the modules and the array features of Fortran 90/95 and C++ languages. MATFOR® is a collection of high-level graphical procedures developed with the mission of reducing time spent on the program development. 5 What Does MATFOR® Do? By adding a few lines of MATFOR® codes to your Fortran/C/C++ program, you can easily visualize your computing results, perform run-time animations, or even produce an interactive movie presentation as you execute your program. 6 … call msSurf(x) call msDrawNow … Why Use MATFOR®? 7 Advanced 3D Visualization Real-Time Animation Runtime Data Manipulation Interactive Movie Presentation Simplicity Standalone Reasons that Make ® MATFOR Standout from Others 8 AnCAD Incorporated Advanced 3D Visualization The graphics library of MATFOR® contains high quality visualization plots for complicated data exhibition. By only adding a few lines of codes to call MATFOR® graphics procedures, the program can be visualized in threedimensional mode. The graphical procedures include streamline, surface plot, vector plot, contour plot, mesh plot, slicing, isosurface, molecules plot, And more… 9 and more. Real-Time Animation MATFOR® features realtime program-monitoring mechanism to reduce time and effort spent on post-processing and debugging. The simulation can be presented as an animation while the calculation proceeds and shows in the console window. 10 • MATFOR presenting simulation while calculating the data. Runtime Data Manipulation MATFOR® allows manipulation of the data displayed during execution; data can be examined with higher precision and customization at runtime. • Graphics Viewer 11 • Data Viewer Interactive Movie Presentation 12 Existing Visual Tools The existing visual tools mainly focus on post processing; segments of motion pictures are assembled in sequence and saved as a movie file. This mechanism only allows viewers to see the animation from one viewpoint. MATFOR® MATFOR® enables interactive movie presentation by saving the simulated data into a MATFOR®defined data format. The completed video clip can be seen from different view angles with built-in graphical manipulation features. Simplicity Besides its simple and powerful visual functions, MATFOR® enables scientists and engineers to code in Matlab fashion using the simple calling concept in Fortran and C++ environments. MATLAB a = inv(x) MATFOR a = mfInv(x) e = eig(x) e = mfEig(x) Calling msSVD in MATFOR® to perform singular value decomposition gives the same result as calling DGESVX in LAPACK. However, MATFOR® function only takes 3 pre-initialized parameters while LAPACK function takes 20 pre-initialized parameters. Call DGESVX( FACT, TRANS, N, NRHS, A, LDA, AF, LDAF, IPIV, EQUED, R, C, B, LDB, X, LDX, RCOND, FERR, BERR, WORK, IWORK, INFO ) LAPACK Call msSVD( mfOut(A, B), C ) MATFOR 13 Standalone Currently, the proprietary format dominates in most visualization tools generate files that can only be executed on one specific application. MATFOR® possesses the ability to convert visualization files into standalone executables. Through the conversion, data sharing and publishing become much easier. Compiling and linking the programs with MATFOR library. Running compiled executables without installing MATFOR. 14 A Quick Comparison Visualization Integration Simplicity Speed FORTRAN Poor Fair Good Excellent C++ Fair Good Fair Good MATLAB® Good Fair Good Poor Tecplot® Excellent Poor Good Fair MATFOR® Excellent Good Excellent Good GINO ® Good Good Fair Fair IMSL® Poor Fair Poor Excellent Languages Applications Libraries 15 Initial Concept of 16 AnCAD Incorporated ® MATFOR MATFOR® Structure MATFOR®, a set of numerical and visualization libraries, is developed to enhance programming in C++ and Fortran environments. Especially designed for scientists and engineers, MATFOR® fulfills the needs of speed and advanced visualization capabilities simultaneously. MATFOR Graphics Library VTK 17 OpenGL Numerical Library Intel MKL MATFOR® Graphics Object I MATFOR® utilizes the Graphics Object Oriented Programming (GOOP) concept to enhance 3D visualization and manipulation. Especially designed to ease maintainability, MATFOR® Graphics Object contains two attributes Data and Representation. “Data” contains the computation results and “Representation” embraces the manipulations of the final graphs. Graphics Object 18 Data Representation “Xdata” “Ydata” “Zdata” … “trans” “ambient” “diffuse” “visable” … MATFOR® Graphics Object II Programmers can change the properties of the output graphs by calling MATFOR® Graphics Object functions. do i = 1, 100 z = mfSin(x+i/8.0d0) * mfCos(y) ! Calculate z value if (i==1) then h = mfSurf(x, y, z) ! Initialize Graphics Object ‘h’ using x, y and z data ! mfSurf constructs a surface plot ! Call msDrawMaterial to set the color component !call msDrawMaterial(h, mf('surf'), mf('visible'), mf('on'),& mf('smooth'), mf('on'),& mf('colormap'), mf('on'),& mf('ambient'), mf(0), & mf('diffuse'), mf(75), & mf('specular'), mf(25)) call msViewPause ! Pause program execution else call msGSet(h, 'zdata', z) ! Change and update the z value of h ! h does not have to be re-initialized call msDrawNow end if end do 19 Call msDrawMaterial MATFOR® Dynamic Array I mfArray Overview mfArray is an advanced dynamic array defined by MATFOR® using modern features of C++ and Fortran 90/95. The mfArray data type consists of descriptors and values. mfArray Descriptors 20 Values •Data Type 8 1 6 (1,1) (1,2) (1,3) •Shape 3 5 7 (2,1) (2,2) (2,3) •Status Flags 4 9 2 (3,1) (3,2) (3,3) MATFOR® Dynamic Array II mfArray Feature A key to integrate MATFOR® toolkit into high-level programming environments Automatic data typing and dimensioning Dynamic memory allocation Simple calling routines with Matlab-like syntax Construct and initialize the mfArray 21 C/C++ Fortran mfArray x,y; x = mfMagic(5); y = mfInv(x); type(mfArray)::x,y x = mfMagic(5) y = mfInv(x) MATFOR® Dynamic Array III mfArray Syntax MATFOR in Fortran MATFOR in C++ Description Basic Assignment a=(1,2) a=dcomplex(1,2) Complex scalar construction a=.T. (/ 1, 2, 3 /) a=mfV(1,2,3).T() Matrix transformation Operator a=mfLDiv(y, x) a=mfLDiv(x, y); Matrix left divided operator a=mfRDiv(y, x) a=y.RDiv(x); Matrix right divided operator a=1:99:2 a=1:2:99 Matrix construction Math Function a=mfInv(x) a=mfInv(x); Matrix inverse e=mfEig(x) e=mfEig(x); Eigenvalues and eigenvectors Visual Function 22 mfSurf(x,y,z) mfSurf(x,y,z) Surface plot h=mfPlot(x,y,’:’) h=mfPlot(x,y,":") Two dimensional linear graphs Fortran Arrays to mfArray • Conversion of native Fortran arrays into mfArray Procedure Memory Duplication Possibility of Stack Overflow Main Purpose mfEquiv No No Using a Fortran array to call a MATFOR procedure. msPointer No No Using Fortran indexing with mfArray or calling a Fortran function using mfArray, msAssign Yes No Memory copy without temporary memory allocation. = Yes Yes Memory copy. * With some Fortran compilers, this may lead to stack memory overflow for insufficiently allocated stack memory. 23 C/C++ Data to mfArray • Conversion of C/C++ data into mfArray 24 Procedure Memory Duplication Main Purpose mfGetRealPtr No Returns the pointer of memory address of a real array mfGetComplexPtr No Returns the pointer of memory address of a complex array mfCreateFromCArray Yes Converts row major C array into mfArray mfCreateFromFArray Yes Converts column major array into mfArray ® MATFOR What Is in That You Can Use? 25 AnCAD Incorporated Numerical Library Based on Intel® MKL, the numerical library contains over 200 easy-touse numerical functions subject to assist users with computational problem-solving. – Data Manipulation Functions: mfSort, mfMin, mfMax, … – Elementary Math Functions: mfSin, mfCos, mfASin, mfExp, mfAbs, … – Elementary Matrix-Manipulating Functions: mfEyes, mfDiag, mfRand, mfZeros, … – Matrix Analysis: mfEig, mfInv, mfSvd, mfQz, mfLu, mfDet, mfNorm, … – File IO: mfSave, mfSaveAscii, mfLoad, mfLodAscii, … 26 Graphics Library Visualization Modules I 27 surf surf mesh mesh plot3 contour contour3 solidcontour trimesh trisurf plot quiver3 molecules quiver pcolor Graphics Library Visualization Modules II isosurface streamline slices contour3 solidconour3 tricontour tetsurf tetmesh tube ribbon molecule image tetisosurface cube, sphere, … 28 tetcontour MATFOR® 3 Sample Code 3D Presentation program main EXE • MATFOR Standalone Executables use fml use fgl ! Declare mfArray variables type(mfArray) :: x, y, z ! Construct grid matrices for 3D plot call msMeshgrid(mfOut(x, y), mfLinspace(-3,3,30), mfLinspace(-3,3,30)) ! Calculate Z value z = mfSin(x) * mfCos(y) ! Plot surf call msSurf(x,y,z) ! Display the graph call msViewPause end program demo codes 29 • MATFOR presents standalone executables. MATFOR® 3 Sample Code Movie Presentation program main AVI use fml use fgl ! Declare mfArray variables ! Declare an integer variable ! Construct grid matrices for 3D plot call msMeshgrid(mfOut(x, y), mfLinspace(-3,3,30), mfLinspace(-3,3,30)) call msRecordStart('demo.avi') ! Begin AVI recording do i=1,50 ! Do loop write (*,*) 'step=', i z = mfSin(x+i/8.0d0) * mfCos(y) ! Calculate Z value if (i==1) then ! Initialize handle h = mfSurf(x, y, z) call msDrawNow else call msGSet(h, 'zdata', z) ! Update Z value call msDrawNow end if end do call msRecordEnd ! End recording call msViewPause ! Pause to display the graph • Movie Files type(mfArray) :: x, y, z, h integer(4) :: I end program 30 demo codes • Viewing the recorded AVI file with media player. MATFOR® 3 Sample Code Interactive Movie Presentation program main MFA use fml use fgl ! Declare mfArray variables ! Declare an integer variable ! Construct grid matrices for 3D plot call msMeshgrid(mfOut(x, y), mfLinspace(-3,3,30), mfLinspace(-3,3,30)) call msRecordStart('demo.mfa') ! Begin AVI recording do i=1,50 ! Do loop write (*,*) 'step=', i z = mfSin(x+i/8.0d0) * mfCos(y) ! Calculate Z value if (i==1) then ! Initialize handle h = mfSurf(x, y, z) call msDrawNow else call msGSet(h, 'zdata', z) ! Update Z value call msDrawNow end if end do call msRecordEnd ! End recording call msViewPause ! Pause to display the graph • MATFOR Defined MFA Files type(mfArray) :: x, y, z, h integer(4) :: I end program 31 demo codes • Viewing and manipulating the recorded MFA file with mfPlayer. MATFOR® mfPlayer An exclusive Visual Tool mfPlayer is an exclusive visual tool by which the previously saved numerical data is read and displayed as an interactive movie presentation. As MATFOR® saves the simulated data into a MATFOR®-defined MFA file, mfPlayer is one approach to present the recorded animation. The complete video clip can then be viewed from different angles. resize rotate zoom pause forward reward view data change colormaps • Data Viewer • mfPlayer 32 More Advanced Feature 33 AnCAD Incorporated Data Viewer MATFOR® Data Viewer is a powerful tool that displays simulating data in a spreadsheet format. Snapshot Panel captures the snapshot of the distribution and size of the two dimensional data. Analysis Panel shows the distribution of the data including its average, standard deviation and min/max values. Filter Panel • defines a range using conditions of inequalities. 34 Snapshot Panel • Analysis Panel • Filter Panel Graphics Viewer MATFOR® Graphics Viewer provides a full range of graphical editing procedures which can be manipulated directly using the menu and the toolbar. • Material Setting Editor • 35 • Axis Setting Editor Colormap Setting Editor Multi-Language Support Various symbols such as Greek letters and the most frequently used mathematical signs are also available. • Multi-language Support The multi-language support utility allows users to input, modify and display foreign character sets. 36 •Symbol Support Full-Screen Function Full Screen Mode The full-screen function allows users to view and/or present data at full screen. This function also serves to eliminate the context for on-screen data capturing and printing. • Use the button indicated to show the graphs in full screen mode 37 MATFOR® Platform and System Requirements 38 AnCAD Incorporated MATFOR® 3 Requirements PLATFORM OPERATING SYSTEM COMPILER In Fortran Intel based systems 32-bit Windows 98/NT/2000/Me/XP Compaq Visual Fortran 6.6B/C Intel C/C++ 7.1/8.1 Digital Fortran 5.0 Visual C++ 6.0 Intel Fortran 7.1 Visual C++ .NET Intel Visual Fortran 8.0/8.1 Borland C++ Builder 6.0 Microsoft Fortran PowerStation 4.0 Lahey Fortran 5.7/7.1 Absoft Fortran 8.2/9.0 Red Hat Linux 9.0 Fedora 1/2/3 Red Hat Enterprise Linux 4.0 White-Box Enterprise 3 SuSE 9.1 Enterprise Intel Fortran 8.1 GNU C++ Lahey Fortran ** Intel C++ 8.1 Absoft Fortran Red Hat Enterprise Linux 3.0 Intel Fortran 8.0 GNU C++ Intel C++ 8.1 Intel Based systems 32-bit EM64T Systems 64-bit **Upcoming Supports 39 COMPILER In C++ ** Successful Cases ® Using MATFOR 40 AnCAD Incorporated Applied Fields Solid Mechanics Fluid Dynamics Electromagnetic Analysis Heat Transfer and Geology Analysis Near-field Optics Calculation Molecular Dynamics 41 Thin-plate Vibration Analysis Fixed Boundary Force Impulse Displacement Speed Acceleration Plate 42 Stress (Data courtesy of Yuan-Sen Yang, National Center for Research on Earthquake Engineering) Structural Earthquake Response Observation Point Displacement Moment Beam Structure 43 (Data courtesy of Professor Yuan-Sen Yang, National Center for Research on Earthquake Engineering) Taiwan Hi-speed Train Vibration Analysis Observation Point Corresponding Point 20m Hi-speed Train Vibration Solid Media 44 (Data courtesy of Edward C. Ting/Chih-Cheng Lin, National Central University) 3D Co-rotational Explicit Finite Element Analysis Destructive External Force Simulation of the nonlinear, nonconsecutive destructive phenomenon of the dam structure based on the finite element method. Elastic Material (Data courtesy of Professor Edward C. Ting/Chih-Cheng Lin, National Central University) 45 Concrete Fracture 2D Analysis Acting Force Support Crack Support (Data courtesy of Professor Edward C. Ting/Yeh-Chan Lin/Chih-Cheng Lin, National Central University) 46 Fluid Field Turbulence I Obstacle Contaminant Obstacle Reynolds number=100 Fluid Field Direction Contaminant (Data courtesy of Ming-Hsin Su, AnCAD, Inc.) 47 Fluid Field Turbulence II Floodway Channel Narrowing (Data courtesy of Ming-Hsin Su, AnCAD, Inc.) 48 High Pressure Reflection Sharp Obstacle High-pressure wave 49 (Data courtesy of Dr. Lin and Dr. Huang, Institute of Science and Technology) 3D Inkjet System Simulation I Blue Print Squeeze Tube Mode Inkjet Printhead Fluid Supply Open End Unit: μm 160 PZT Cavity 80 40 80 L 800 Close End Orifice Nozzle 50 (Data courtesy of Weng-Sing Huang/Hsuan-Chung Wu, National Cheng Kung University) 3D Inkjet System Simulation II Computer Simulation (Data courtesy of Weng-Sing Huang/Hsuan-Chung Wu, National Cheng Kung University) 51 3D Inkjet System Simulation III Results Comparison breaking Time: 0 [μs ] 52 20 26 32 38 44 50 56 62 68 74 (Data courtesy of Weng-Sing Huang/Hsuan-Chung Wu, National Cheng Kung University) 80 Water Molecule Phase Transition Water Molecules 30 nm 53 (Data courtesy of Chin-Hsiang Cheng, Tatung University) Ion Perturbation Analysis Ion A Ion B Distance between ions A and B (Data courtesy of Yu-Chang Sheng, National Taiwan University) 54 EM-wave Scattering on Perfectly Matched Layer EM-impulse Amplitude Perfectly Matched Layer 55 (Data courtesy of Chun-Hao Teng, AnCAD, Inc.) Multi-layer Ground Noise in a Current Field I Single microstrip line crossing slot Rg Vs pow er p lane gro und plan e Slotl ine RL Current Current Layer Ground Layer Slot Amplitude 56 (Data courtesy of Ruey-Beei Wu/Kuang-Hua Hsueh, National Taiwan University) Multi-layer Ground Noise in a Current Field II Differential microstrip line crossing slot (coupling factor = 0.305) pow Slotl ane er p l gro und plan e ine Current Current Layer Ground Layer Slot Amplitude 57 (Data courtesy of Ruey-Beei Wu/Kuang-Hua Hsueh, National Taiwan University) Photonic Band Gap Waveguide Transmission I The blueprint of future integrated optical circuits. (Data courtesy of Department of Physics & Astronomy, University of St Andrews, UK) 58 Photonic Band Gap Waveguide Transmission II Line Defect Light Source Photonic Band Gap (Data courtesy of Dr. Pei-Kun Wei, Academia Sinica, Taiwan) 59 Amplitude Finite-difference Time-domain Analysis Wave Source Wave Source Obstacle 60 (Data courtesy of Yu-Jen Lin, Precision Instrument Development Center) Obstacle Analysis of Optical Thin-film Coated Micro-lens Micro-lens Light Source 61 (Data courtesy of Tung-Lung Fu, Precision Instrument Development Center) Analysis of Ancient Ground Temperature in an Expanding Basin Ground Surface 1Ma=1 million years ago Ground Temperature 6000m below the surface 62 (Data courtesy of Wei-Hau Wang/Hsun Hsien, National Chung Cheng University) AnCAD Incorporated 63 AnCAD Incorporated What kind of company is AnCAD? Established in 1999 Devoted to the field of Scientific Computation Cultivated an integrated environment 64 High frequency interconnect analysis Molecular dynamics IC design simulation Electromagnetic analysis Heat transfer modeling Computational fluid dynamics Cross-platform Parallel computing Clustering dynamic visualization Affiliation with AnCAD Intel’s sole distributor in Taiwan Cooperated with Intel and HP to implement iThinker 64 project Partners with Absoft, Inc. and Lahey, Inc. Carried out global bundle-selling for Absoft Fortran compiler and Lahey Fortran compiler Outstanding achievement in worldwide sales and marketing More than 20 worldwide resellers 65 AnCAD's Worldwide Distributors Absoft Lahey UK Netherlands Ireland Germany Poland France Switzerland Spain Portugal Italy Israel Korea Japan Pakistan India Taiwan Malaysia Singapore Brazil HQ/R&D Center Bundle Selling Compiler Vendors Distributors 66 Resellers Australia New Zealand AnCAD http://www.ancad.com Website Support • AnCAD information • MATFOR information • Case studies • Newsletters • Free MATFOR trial Technical Support • MATFOR documentations • FAQs • Online forum • E-mail Support : support@ancad.com 67 AnCAD Incorporated Question? 68 AnCAD Incorporated