Skip to content

Tools for computing stress-strain behaviors. The stress functions should be able to return the stress and the jacobian w.r.t. the strain metric of interest.

License

Notifications You must be signed in to change notification settings

UCBoulder/tardigrade_stress_tools

 
 

Repository files navigation

stress_tools

Project Description

Tools for computing stress-strain behaviors. The stress functions should be able to return the stress and the jacobian w.r.t. the strain metric of interest.

Information

Developers

Dependencies

Compilers

  • c++11 compiler (listed version number has been tested at some point)
    • g++ >= GNU 4.8.5

Executables

Python Modules (for documentation)

For convenience, the minimal Python environment requirements for the documentation build are included in environment.txt. A minimal anaconda environment for building the documentation can be created from an existing anaconda installation with the following commands.

$ conda create --name tardigrade_stress_tools-env --file environment.txt --channel file:///projects/aea_compute/aea-conda --channel conda-forge

You can learn more about Anaconda Python environment creation and management in the [Anaconda Documentation](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html)

C++ Libraries

Note

NOTE: Non-admin installations for Eigen and Boost are no longer required. This project is built and deployed against C++ libraries managed in Conda. See the Conda environment file and README discussion for non-admin environment management.

If not found on the current system or active Conda environment, all of the *_tools libraries are pulled from their git repos by branch name and built with their respective cmake files as part of the cmake build for this project.

Build and Test

This project is built with [CMake](https://cmake.org/cmake/help/v3.14/) and uses [Sphinx](https://www.sphinx-doc.org/en/master/) to build the documentation with [Doxygen](https://www.doxygen.nl/manual/docblocks.html) + [Breathe](https://breathe.readthedocs.io/en/latest/) for the c++ API.

Warning

API Health Note: The sphinx API docs are a work-in-progress. The doxygen API is much more useful

sstelmo

  1. Activate the shared development environment

    $ module use /projects/aea_compute/modulefiles
    $ module load tardigrade_stress_tools-env
  2. Build everything

    $ pwd
    /path/to/tardigrade_stress_tools/
    $ mkdir build
    $ cd build
    $ cmake ..
    $ cmake --build . --target all
  3. View test results

    cat build/src/cpp/tests/results.tex
  4. Display docs

    # Sphinx
    firefox build/docs/sphinx/html/index.html &
    
    # Doxygen
    firefox build/docs/doxygen/html/index.html &

Local development

In some cases it is not convenient to pull down every repository required but it may be desired that local versions of the repository are used. An example of when this may be needed is if development is across multiple libraries and is proceeding faster than collaborators can check in results. In this case, and outside of developers no-one should need to do this, a version of the code using local repositories can be built.

To perform in-source builds of upstream libraries, the active Conda environment can NOT include installed versions of the upstream libraries to be built in-source with the current project. It is possible to mix sources with some upstream libraries coming from the active Conda environment and others built in-source from a Git repository. Developers may build minimal working Conda environments from the Python Modules discussion.

  1. Build and activate a minimal Conda development environment

    $ conda create --name tardigrade_stress_tools-env --file environment.txt --channel file:///projects/aea_compute/aea-conda --channel conda-forge
    $ conda activate tardigrade_stress_tools-env
  2. Define convenience environment variables

    $ tardigrade_error_tools=/path/to/my/tardigrade_error_tools
    $ tardigrade_error_tools_version=origin/dev
    $ tardigrade_vector_tools=/path/to/my/tardigrade_vector_tools
    $ tardigrade_vector_tools_version=origin/dev
  3. Perform the initial configuration. Note that the environment variables are mutually independent. Each variable can be used alone or in arbitrary combinations. The default values are found in the root CMakeLists.txt file. The PATH variables can accept anything that the [CMake FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) GIT_REPOSITORY option can accept. The GITTAG variables will accept anything that the [CMake FetchContent](https://cmake.org/cmake/help/latest/module/FetchContent.html) GIT_TAG option can accept.

    # View the defaults
    $ grep _TOOLS_ CMakeLists.txt
    set(TARDIGRADE_ERROR_TOOLS_PATH "" CACHE PATH "The path to the local version of tardigrade_error_tools")
    set(TARDIGRADE_ERROR_TOOLS_GITTAG "" CACHE PATH "The path to the local version of tardigrade_error_tools")
    set(TARDIGRADE_VECTOR_TOOLS_PATH "" CACHE PATH "The path to the local version of tardigrade_vector_tools")
    set(TARDIGRADE_VECTOR_TOOLS_GITTAG "" CACHE PATH "The path to the local version of tardigrade_vector_tools")
    
    $ Build against local directory paths and possible custom branch
    $ pwd
    /path/to/tardigrade_stress_tools
    $ mkdir build
    $ cd build
    $ cmake .. -DFETCH_SOURCE=LOCAL -DTARDIGRADE_ERROR_TOOLS_PATH=${tardigrade_error_tools} -DTARDIGRADE_VECTOR_TOOLS_PATH=${tardigrade_vector_tools}
  4. Building the library

    $ pwd
    /path/to/tardigrade_stress_tools/build
    $ make

Building the documentation

To build just the documentation pick up the steps here:

  1. Create the build directory and move there

    $ pwd
    /path/to/tardigrade_stress_tools/
    $ mkdir build/
    $ cd build/
  2. Run cmake3 configuration

    $ pwd
    /path/to/tardigrade_stress_tools/build/
    $ cmake3 ..
  3. Build the docs

    $ cmake3 --build docs
  4. Documentation builds to:

    tardigrade_stress_tools/build/docs/sphinx/index.html
  5. Display docs

    $ pwd
    /path/to/tardigrade_stress_tools/build/
    $ firefox docs/sphinx/index.html &
  6. While the Sphinx API is still a WIP, try the doxygen API

    $ pwd
    /path/to/tardigrade_stress_tools/build/
    $ firefox docs/doxygen/html/index.html &

Install the library

Build the entire before performing the installation.

  1. Build the entire project

    $ pwd
    /path/to/tardigrade_stress_tools/build
    $ cmake3 --build .
  2. Install the library

    $ pwd
    /path/to/tardigrade_stress_tools/build
    $ cmake --install . --prefix path/to/root/install
    
    # Example local user (non-admin) Linux install
    $ cmake --install . --prefix /home/$USER/.local
    
    # Example install to conda environment
    $ conda activate my_env
    $ cmake --install . --prefix ${CONDA_DEFAULT_ENV}

Contribution Guidelines

Git Commit Message

Begin Git commit messages with one of the following headings:

  • BUG: bug fix
  • DOC: documentation
  • FEAT: feature
  • MAINT: maintenance
  • TST: tests
  • REL: release
  • WIP: work-in-progress

For example:

git commit -m "DOC: adds documentation for feature"

Git Branch Names

When creating branches use one of the following naming conventions. When in doubt use feature/<description>.

  • bugfix/\<description>
  • feature/\<description>
  • release/\<description>

reStructured Text

[Sphinx](https://www.sphinx-doc.org/en/master/) reads in docstrings and other special portions of the code as reStructured text. Developers should follow styles in this [Sphinx style guide](https://documentation-style-guide-sphinx.readthedocs.io/en/latest/style-guide.html#).

Style Guide

This project does not yet have a full style guide. Generally, wherever a style can't be inferred from surrounding code this project falls back to [PEP-8](https://www.python.org/dev/peps/pep-0008/)-like styles. There are two notable exceptions to the notional PEP-8 fall back:

  1. [Doxygen](https://www.doxygen.nl/manual/docblocks.html) style docstrings are required for automated, API from source documentation.

  2. This project prefers expansive whitespace surrounding parentheses, braces, and brackets. * No leading space between a function and the argument list. * One space following an open paranthesis (, brace {, or bracket

    [

    • One space leading a close paranthesis ), brace }, or bracket ]

An example of the whitespace style:

my_function( arg1, { arg2, arg3 }, arg4 );

The following sed commands may be useful for updating white space, but must be used with care. The developer is recommended to use a unique git commit between each command with a corresponding review of the changes and a unit test run.

  • Trailing space for open paren/brace/bracket

    sed -i 's/\([({[]\)\([^ ]\)/\1 \2/g' <list of files to update>
  • Leading space for close paren/brace/bracket

    sed -i 's/\([^ ]\)\([)}\]]\)/\1 \2/g' <list of files to update>
  • White space between adjacent paren/brace/bracket

    sed -i 's/\([)}\]]\)\([)}\]]\)/\1 \2/g' <list of files to update>

About

Tools for computing stress-strain behaviors. The stress functions should be able to return the stress and the jacobian w.r.t. the strain metric of interest.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C++ 96.3%
  • CMake 3.7%