Skip to content

Commit

Permalink
Merge branch 'master' into poisson_disk
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeffrey Hyman committed Dec 19, 2023
2 parents 8040123 + dd5db69 commit d2a29f7
Show file tree
Hide file tree
Showing 18 changed files with 659 additions and 98 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ $ cd LaGriT/
### Building LaGriT ###
---

#### Building LaGriT - long version

[Building LaGriT with cmake and exodus](cmake/README.md)


Expand Down
104 changes: 88 additions & 16 deletions cmake/README.md
Original file line number Diff line number Diff line change
@@ -1,31 +1,65 @@
# CMake Build System
# LaGriT and ExodusII with cmake

The CMake build system is a way of enabling LaGriT to
be cross-platform, cross-architecture, and cross-compiler.
The CMake build system is a way of enabling LaGriT to be cross-platform, cross-architecture, and cross-compiler. This page is a verbose description of building LaGriT and includes instructions for building the optional library for ExodusII.

The CMake build is controlled by CMakeLists.txt and files in directory /cmake

The ExodusII libraries can be built using install-exodus.sh
For additional help on ExodusII, see instructions at https://github.com/sandialabs/seacas
**Note for Exodus with LaGriT, FORTRAN must be set to YES**

See Build and Install Instructions: https://github.com/lanl/LaGriT#readme

There's a really good tutorial-overview on CMake here, it covers how to handle multiple build configurations: https://cliutils.gitlab.io/modern-cmake/


## Code Development
## Download LaGriT

You can build as Debug (-g) or as Release with the CMake flag "-D CMAKE_BUILD_TYPE=[Debug|Release]".
There's two stages in CMake; the 'configure' stage (where you run 'cmake ..') and the build stage (where you run 'make' using the Makefile created by cmake)

The build type can only be set in the configure stage. One way to handle building both Debug and release is to make two build directories. Here's a short guide: https://riptutorial.com/cmake/example/7357/switching-between-build-types--e-g--debug-and-release
Download the repo as shown under the Code button on git.
For developers, be sure to use SSH version to clone.

You can set cmake and make to show verbose screen reporting. These are run from your buld directory with the following options:
```
cmake -D CMAKE_FIND_DEBUG_MODE=ON ..
make VERBOSE=1
$ git clone [email protected]:lanl/LaGriT.git
$ cd LaGriT/
```

If SSH Key needed, generate a key for your machine.
[See GitHub Docs for SSH Key](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent)
```
Generate a SSH key (NOT RSA) in your .ssh directory.
ssh-keygen -t ed25519 -C "email.lanl.gov"
Copy contents of id_ed25519.pub into your SSH Keys on github (under settings).
```

For LANL developers, you may need to generate a token to use as password. See instructions at https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token
## Build ExodusII (optional)

See instructions in install-exodus.sh

LaGriT will use libs and files located in TPLs/seacas

Expected libs and include files:

```
lib/libexodus.a lib/libexoIIv2for32.a lib/libhdf5_hl.a lib/libnetcdf.a
lib/libexodus_for.a lib/libhdf5.a lib/libhdf5_tools.a lib/libz.a
include/exodus_config.h include/exodusII.h include/exodusII.inc include/exodusII_par.h
include/netcdf.h include/hdf5.h
```

Once the ExodusII is successful, build LaGriT as usual but with the EXODUS flag:

```
mkdir build/ && cd build/
cmake .. -DCMAKE_BUILD_TYPE=Debug -DLAGRIT_BUILD_EXODUS=ON
make
```

## Create your build directory:

You can build as Debug (-g) or as Release with the CMake flag "-D CMAKE_BUILD_TYPE=[Debug|Release]".
There's two stages in CMake; the 'configure' stage (where you run 'cmake ..') and the build stage (where you run 'make' using the Makefile created by cmake)

The build type can only be set in the configure stage (with cmake) and will apply to all files in your build directory. If you make a change to cmake, you will need to run in a new directory, or remove all the files and directories created with your previous cmake configuration.

Setup a work directory for dev and debug work (example using name "debug").
Use cmake to create Makefiles and build files. You will do this only once.
Compile the lagrit executable using 'make' or 'make VERBOSE=1'
Expand All @@ -36,8 +70,14 @@ make
```

Run ./lagrit and type command **test** which creates hex mesh and reports expected values.

For debugging the build process, set cmake and make to show verbose screen reporting. These are run from your build directory with the following options:
```
cmake -D CMAKE_FIND_DEBUG_MODE=ON ..
make VERBOSE=1
```
## Modify code
## Modify code and update **lagrit** executable

Modify code by working with lagrit source files in LaGriT/src
Do not add any non-code develpment files in the /src directory, they may be detected and attempted to use during compile time.
Expand All @@ -55,7 +95,7 @@ make


### Example Directory structure for development:
### Example Directory structure for developers:
```
LaGriT/
Expand Down Expand Up @@ -132,8 +172,11 @@ make[2]: Leaving directory '/project/eesdev/tam/LaGriT/build'
[100%] Built target lagrit
```

## Automatic Configurations

This is work performed by cmake and is usually not modified. Cmake is used to do some automatic file edits that depend on the machine or platform you are using.

## Header File configuration
### Header File configuration

CMake automatically configures two header files:

Expand Down Expand Up @@ -164,3 +207,32 @@ configure_file(

The variable above - `@PROJECT_VERSION_MAJOR@` is an instrinsic CMake variable. You can define your own. For example, CMake code within `SetBitSize.cmake` configures the `lg_util/src/mm2000.h.in` file.

### C-Fortran Compatibility

LaGriT codes include both Fortran and C/C++ code files. The driver routines are Fortran, the C/C++ files use wrapper functions and definitions set by cmake before code is compiled. These are set during the configuration and should not need to be modified unless new routines are added.

cmake writes fc_mangle.h for c-fortran routines. This file handles the symbol mangling for routines declared in src/lg_f_interface.h include file. For more information on this method visit https://www.netlib.org/lapack/lawnspdf/lawn270.pdf

The C++ wrapper routines need to be listed in CMakeLists.txt:

```
FortranCInterface_HEADER(
${SRC_CORE}/fc_mangle.h
SYMBOLS
INITLAGRIT # syntax: <subroutine>
DOTASK
CMO_GET_NAME
CMO_GET_INFO
CMO_GET_INTINFO
FC_CMO_GET_INT
FC_CMO_GET_VINT
FC_CMO_GET_DOUBLE
FC_CMO_GET_VDOUBLE
FPASS_TYPES
INSIDE_TET
LINESEG_TRI)
```




20 changes: 12 additions & 8 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,19 @@ title: LaGriT - Home
<div class="button" id="button-4">
<div id="underline"></div>
<a href="https://lanl.github.io/LaGriT/pages/tutorial/index.html">Take the Tutorial</a>
<a href="https://lanl.github.io/LaGriT/pages/manual.html">LaGriT Manual</a>
</div>

<div class="button" id="button-4">
<div id="underline"></div>
<a href="https://lanl.github.io/LaGriT/pages/tutorial/index.html">LaGriT Tutorial</a>
</div>

<div class="button" id="button-4">
<div id="underline"></div>
<a href="https://lanl.github.io/LaGriT/pylagrit/original/index.html">PyLaGriT Manual</a>
</div>

</div>
</div>

Expand Down Expand Up @@ -69,12 +79,6 @@ incorporating uncertainty in system geometry and automatic mesh
generation.


## Documentation


- [LaGriT Manual](pages/manual.md)
- [PyLaGriT Manual](/pylagrit/original/index.html)


## About LaGriT

Expand Down
12 changes: 7 additions & 5 deletions docs/pages/development.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
LaGriT Code Development Team
----------------------------

[Carl W. Gable](http://www.lanl.gov/expertise/profiles/view/carl-gable), Geological Applications
[Carl W. Gable](http://www.lanl.gov/search-capabilities/profiles/carl-gable.shtml) Author (Retired from LANL)

[Terry Miller](http://www.lanl.gov/search-capabilities/profiles/terry-miller.shtml) Support

[Jeffrey De'Haven Hyman](http://www.lanl.gov/search-capabilities/profiles/jeffrey-hyman.shtml) Applications

[Tinka Gammel](http://public.lanl.gov/jtg/)

Denise George (Retired)

[Andrew Kuprat](http://www.pnnl.gov/science/staff/staff_info.asp?staff_num=7019)

[Terry Miller](http://www.lanl.gov/expertise/profiles/view/terry-miller)

Frank A. Ortega

[Harold Trease](http://www.sysbio.org/resources/staff/trease.stm)
[Harold Trease](http://www.sysbio.org/resources/staff/trease.stm) Retired from LANL

[Lynn Trease](http://www.sysbio.org/resources/staff/l-trease.stm)
[Lynn Trease](http://www.sysbio.org/resources/staff/l-trease.stm) Retired from LANL

Robert B. Walker

42 changes: 29 additions & 13 deletions docs/pages/docs/build.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,22 @@ Tags: Manual Building an executable and running LaGriT
The executable is built by linking a driver routine with the code and
utility libraries. The driver routine must contain a call to initLaGriT
and a call to control_command_lg and must contain a subroutine called
user_sub.  The input arguments to initLaGriT are:
user_sub. 

The input arguments to initLaGriT are:

**mode** - set to 'noisy' for output to be echoed to the screen - set to
'silent' for no echo

**log_file** - name of log file (if ' ' or '-def-' use default name which
is logx3dgen)  This file will contain a list of commands.
is lagrit.log)  This file will contain a list of commands.

**batch_file** - name of batch file (if ' ' or '-def-' use default name
which is outx3dgen). This file will contain a list of commands and the
which is lagrit.out). This file will contain a list of commands and the
error, warning and informational messages generated by the command.
User_sub is used to implement user commands, see [User Commands](writing.md).

A sample driver routine is listed below:
A sample Fortran driver routine is listed below (C++ examples are in examples/liblagrit/):

<pre>
program adrivgen
Expand Down Expand Up @@ -82,11 +84,31 @@ C For example

### Sample build scripts

LaGriT can be compiled on most modern machines including Linux, Mac, and WINDOWS.
LaGriT can be compiled on most modern machines including Linux, and Mac. WINDOWS is still under development, but pre-cmake versions were successful under Cygwin. LaGriT now uses cmake to build with or without external libraries such as Seacas Exodus.

The most recent instructions can be found on the github pages.


Simple install, build, and test: [LaGriT Github README](https://github.com/lanl/LaGriT/blob/master/README.md)

Build options and instructions for developers: [LaGriT Github cmake README](https://github.com/lanl/LaGriT/blob/master/cmake/README.md)



### Running LaGriT

*Note examples may be out of date, see [LaGriT Github](https://github.com/lanl/LaGriT)*
To execute, use standard unix file redirection for standard input and
output. LaGriT will produce two additional files, lagrit.out and
lagrit.log. The user can change the names of these files by supplying new
names as arguments in the call to initLaGriT before compiling.  These files contain
detailed output information and the list of commands respectively.
LaGriT may also be run interactively in which case the user will be
prompted to enter commands at the machine prompt.

lagrit < lagrit_command_file


### The following are examples to build old releases (pre V3.2) but may be helpful on older machines.

**Sun OS and Sun Solaris forte version 7 compiler:**

Expand Down Expand Up @@ -185,10 +207,4 @@ where fdate.f is



To execute, use standard unix file redirection for standard input and
output. LaGriT will produce two additional files, outx3dgen and
logx3dgen. The names of these files can be changed by supplying the
names as arguments in the call to initLaGriT.  These files contain
detailed output information and the list of commands respectively.
LaGriT may also be run interactively in which case the user will be
prompted to enter commands from the workstation.

4 changes: 2 additions & 2 deletions docs/pages/docs/commands/cmo/cmo_addatt.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,10 @@ See also the command [**`QUALITY`**](../QUALITY.md) for adding attributes such a
**ang_mind_solid** / `att_name` <br> create a scalar element attribute and fill it with the minimum solid angle (degrees) of the element

<a name="ang_mind_solid"></a>
**ang_maxd_solid** / `att_name` <br> create a scalar element attribute and fill it with the minimum solid angle (radian) of the element
**ang_minr_solid** / `att_name` <br> create a scalar element attribute and fill it with the minimum solid angle (radian) of the element

<a name="ang_mind_solid"></a>
**ang_minr_solid** / `att_name` <br> create a scalar element attribute and fill it with the maximum solid angle (degrees) of the element
**ang_maxd_solid** / `att_name` <br> create a scalar element attribute and fill it with the maximum solid angle (degrees) of the element

<a name="ang_mind_solid"></a>
**ang_maxr_solid** / `att_name` <br> create a scalar element attribute and fill it with the maximum solid angle (radian) of the element
Expand Down
3 changes: 3 additions & 0 deletions docs/pages/docs/commands/createpts.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ This command adds points to a mesh object. For some special cases, it will also

**[createpts/interp](createpts/createpts_interp.md)** Creates points by linear interpolation between two point sets.


**[createpts/poisson_disk](createpts/createpts_poisson.md)** Use Poisson Disk sampling to create uniform or variable spaced points inside a polygon.

**[createpts/sphere](createpts/cresphere.md)** Create points for a sphere.

**[createpts/random](createpts/CRTPTRZRAN.md)** Add random points within region.
Expand Down
Loading

0 comments on commit d2a29f7

Please sign in to comment.