2.2. Creating a Custom Mesh Import Executable for CFX-Pre

You can create your own customized program using the 'C' programming language or Fortran programming language. A number of API functions are provided in a library supplied with the Ansys CFX installation. For details, see Details of the Mesh Import API.

The installation contains a C source code example file that can be used as the basis of your custom executable. This file, ImportTemplate.c, is provided in <CFXROOT>/examples/, and is listed in: An Example of a Customized C Program for Importing Meshes into CFX-Pre.

The basic structure of a program written to import a 3rd-party mesh into CFX-Pre is as follows:

  1. Inclusion of the cfxImport.h header file (for C programs and not Fortran programs).

  2. Initialization for import with the cfxImportInit routine.

  3. Definition of node data with cfxImportNode.

  4. Definition of element data with cfxImportElement.

  5. Optionally, definitions of 2D and 3D regions with either cfxImportRegion or the following three functions: cfxImportBegReg, cfxImportAddReg, cfxImportEndReg

  6. Data transfer with cfxImportDone.

The header files associated with the API are located in <CFXROOT>/include/. If you do not use the header file cfxImport.h, the functionality of the routines contained within the API may not follow defined behavior.

After writing the program, you will need to compile the source code. For details, see Compiling Code with the Mesh Import API.

You will also need to link your routine with the API routine libraries. For details, see Linking Code with the Mesh Import API.

After a customized executable has been produced, it can be run in CFX-Pre. For details, see User Import.