-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add sphinx docs * switch to installing package * fix the mock * also mock numpy * moved instructions from README to sphinx * added API docs * fix bash commands
- Loading branch information
Showing
9 changed files
with
128 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,11 @@ | ||
# cgnsUtilities | ||
[![Build Status](https://dev.azure.com/mdolab/Public/_apis/build/status/mdolab.cgnsutilities?repoName=mdolab%2Fcgnsutilities&branchName=main)](https://dev.azure.com/mdolab/Public/_build/latest?definitionId=30&repoName=mdolab%2Fcgnsutilities&branchName=main) | ||
[![Documentation Status](https://readthedocs.com/projects/mdolab-cgnsutilities/badge/?version=latest)](https://mdolab-cgnsutilities.readthedocs-hosted.com/en/latest/?badge=latest) | ||
[![codecov](https://codecov.io/gh/mdolab/cgnsutilities/branch/main/graph/badge.svg?token=ZCO3MR2LNL)](https://codecov.io/gh/mdolab/cgnsutilities) | ||
|
||
This repository contains a single program called `cgns_utils` that | ||
provides many useful functions for working with cgns grids. | ||
|
||
## Installation Instructions | ||
|
||
First, copy the default configuration file to the required name. For example, to use gfortran: | ||
|
||
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk | ||
|
||
Open and edit the config file. | ||
You many have to adjust the `CGNS_INCLUDE_FLAGS` and `CGNS_LINKER_FLAGS` to match your installation of the CGNS library. | ||
You may also specify the c-compiler with the `CC` variable and the flags for the c-compiler with `CFLAGS`. | ||
The C-compiler is only used for the compiler `f2py` wrapper. | ||
The Fortran compiler may be specified with the `FC` variable and the corresponding flags with the `FFLAGS` variable. | ||
It has been tested with both Intel and GNU Fortran compilers. | ||
|
||
To compile, simply type | ||
|
||
make | ||
|
||
If all goes well, you will see | ||
|
||
Testing if module libcgns_utils can be imported... | ||
Module libcgns_utils was successfully imported. | ||
|
||
which indicates a successful compilation. | ||
|
||
To install, type | ||
|
||
pip install . | ||
|
||
or optionally with the `--user` flag if you are not using a virtual environment. | ||
A console script called `cgns_utils` is provided, which should be installed automatically and available without modifying your `$PATH`. | ||
|
||
## Usage | ||
|
||
All of the `cgnsUtilties` functionality is accessible through the `cgns_utils` command. | ||
To see a list of the available sub-commands, type | ||
|
||
cgns_utils -h | ||
|
||
To get further help for a sub-command, type for example: | ||
|
||
cgns_utils scale -h | ||
|
||
## License | ||
|
||
Copyright 2020 MDO Lab. See the LICENSE file for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
API | ||
=== | ||
.. automodule:: cgnsutilities.cgnsutilities | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
Command Line Interface | ||
====================== | ||
|
||
.. argparse:: | ||
:module: cgnsutilities.cgns_utils | ||
:func: get_parser | ||
:prog: cgns_utils |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line, and also | ||
# from the environment for the first two. | ||
SPHINXOPTS ?= | ||
SPHINXBUILD ?= sphinx-build | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
from sphinx_mdolab_theme.config import * | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
from unittest.mock import MagicMock | ||
|
||
sys.path.insert(0, os.path.abspath("../")) | ||
|
||
extensions.extend(["sphinxarg.ext"]) | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "CGNS Utilities" | ||
|
||
|
||
# We have to mock some stuff | ||
# and sphinxarg.ext does NOT use the autodoc mock feature | ||
|
||
for mod in ["cgnsutilities.libcgns_utils", "numpy"]: | ||
sys.modules[mod] = MagicMock() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
.. CGNS Utilities documentation master file, created by | ||
sphinx-quickstart on Mon Mar 29 10:19:14 2021. | ||
You can adapt this file completely to your liking, but it should at least | ||
contain the root `toctree` directive. | ||
============== | ||
CGNS Utilities | ||
============== | ||
cgnsUtilities is a collection of CLI program and utility functions for working with CGNS grids. | ||
|
||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Contents: | ||
|
||
install | ||
API | ||
CLI |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Installation Instructions | ||
========================= | ||
|
||
First, copy the default configuration file to the required name. For example, to use gfortran: | ||
|
||
.. prompt:: bash | ||
|
||
cp config/defaults/config.LINUX_GFORTRAN.mk config/config.mk | ||
|
||
Open and edit the config file. | ||
You many have to adjust the ``CGNS_INCLUDE_FLAGS`` and ``CGNS_LINKER_FLAGS`` to match your installation of the CGNS library. | ||
You may also specify the C compiler with the ``CC`` variable and the flags for the C compiler with ``CFLAGS``. | ||
The C-compiler is only used for the compiler ``f2py`` wrapper. | ||
The Fortran compiler may be specified with the ``FC`` variable and the corresponding flags with the ``FFLAGS`` variable. | ||
It has been tested with both Intel and GNU Fortran compilers. | ||
|
||
To compile, simply type | ||
|
||
.. prompt:: bash | ||
|
||
make | ||
|
||
If all goes well, you will see:: | ||
|
||
Testing if module libcgns_utils can be imported... | ||
Module libcgns_utils was successfully imported. | ||
|
||
which indicates a successful compilation. | ||
|
||
To install, type | ||
|
||
.. prompt:: bash | ||
|
||
pip install . | ||
|
||
or optionally with the ``--user`` flag if you are not using a virtual environment. | ||
A console script called ``cgns_utils``` is provided, which should be installed automatically and available without modifying your ``$PATH``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
sphinx_mdolab_theme | ||
sphinx-argparse |