MAJ terminée. Nous sommes passés en version 14.6.2 . Pour consulter les "releases notes" associées c'est ici :

https://about.gitlab.com/releases/2022/01/11/security-release-gitlab-14-6-2-released/
https://about.gitlab.com/releases/2022/01/04/gitlab-14-6-1-released/

Commit e2615170 authored by Olivier Cots's avatar Olivier Cots
Browse files

Merge branch 'develop' into feature/anim

parents 590b69e0 cd4bef40
......@@ -29,3 +29,4 @@ bocopApp
bocopwrapper.py
!bocop/
*.sol
libbocop.dylib
......@@ -11,3 +11,4 @@ MINPACK = "4854310b-de5a-5eb6-a2a5-c1dee2bd17f9"
NLsolve = "2774e3e8-f4cf-5e23-947b-6d7e65073b56"
Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f"
OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed"
PyCall = "438e738f-606a-5dbb-bf0a-cddfbfd45ab0"
......@@ -6,3 +6,48 @@ Jupyter notebooks for use cases using solvers of `bocop` & `nutopy` packages and
[![Full directory](https://mybinder.org/badge_logo.svg)](https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.inria.fr%2Fct%2Fgallery.git/master?urlpath=lab/)
Special thanks: [A. Hurtig](http://www.alain.les-hurtig.org) for the logos ligatures
## Procedure to get the examples and install the packages
In the following, `ROOT` is a variable standing for the root directory where the course repository will be stored. For example,
```bash
export ROOT=${HOME}
```
The examples are given in the form of python notebooks. To download all the examples, use the `git` command ([git](https://git-scm.com/downloads)). To clone the git repository and get the examples:
```bash
cd $ROOT
git clone https://gitlab.inria.fr/ct/gallery.git
```
The examples of our gallery uses python packages (see `pkg/env` directory). All theses packages may be installed in a conda environment for ease of use.
If you do not have the `conda` command, please install [miniconda](https://docs.conda.io/en/latest/miniconda.html) or [conda](https://docs.conda.io/en/latest/) (conda is longer to install than miniconda). Then, create the conda environment:
```bash
cd $ROOT/gallery
conda env create -f pkg/env/gallery-<YOUR_OS>.yaml
```
Where <YOUR_OS> must be replaced by ```linux```, ```mac``` or ```windows```, according to the platform used.
> If you only want to install the packages, that is you do not want to download all the examples, you can simply
> download the file `pkg/env/gallery-<YOUR_OS>.yaml` and then create the conda environment with:
> ```bash
> conda env create -f gallery-<YOUR_OS>.yaml
> ```
Activate the gallery conda environment to get access to all the packages:
```bash
conda activate gallery-dev
```
Run jupyterlab and access to the examples (in subdirectory `examples`):
```bash
jupyter-lab
```
## Revoming the environment
You can remove the gallery environment doing:
```bash
conda activate base
conda env remove --name gallery-dev
```
......@@ -2,9 +2,6 @@
import os
import sys
#import pkg_resources
#sys.path.insert(0, os.path.abspath('../../src'))
# Use sphinx-quickstart to create your own conf.py file!
# After that, you have to edit a few things. See below.
......@@ -13,39 +10,19 @@ import sys
# ----------------------------------------------------------------------------------------
# Select nbsphinx and, if needed, other Sphinx extensions:
extensions = [
'matplotlib.sphinxext.plot_directive',
'sphinx.ext.autodoc', # for generation of api documentation
'sphinx.ext.napoleon', # numpy docstrings
'sphinx.ext.intersphinx', # to reference others projects, as numpy.ndarray
# 'sphinx.ext.doctest', # for the presentation of result in api documentation examples
'recommonmark', # for the use of markdown files for the documentation
'nbsphinx',
'nbsphinx_link', # A sphinx extension for including notebook files from outside the sphinx source root.
'sphinx_copybutton', # for "copy to clipboard" buttons
'sphinx.ext.mathjax', # for math equations
'nbsphinx_link', # A sphinx extension for including notebook files from outside the sphinx source root.
'sphinx_copybutton', # for "copy to clipboard" buttons
'sphinx.ext.mathjax', # for math equations
'sphinx.ext.viewcode',
'sphinxcontrib.bibtex', # for bibliographic references
# 'sphinxcontrib.rsvgconverter', # for SVG->PDF conversion in LaTeX output
'sphinx_gallery.load_style', # load CSS for gallery (needs SG >= 0.6)
'sphinxcontrib.bibtex', # for bibliographic references
'sphinx_gallery.load_style', # load CSS for gallery (needs SG >= 0.6)
]
## Napoleon settings
napoleon_google_docstring = False
napoleon_numpy_docstring = True
#napoleon_include_init_with_doc = False
#napoleon_include_private_with_doc = False
#napoleon_include_special_with_doc = True
napoleon_use_admonition_for_examples = True
napoleon_use_admonition_for_notes = True
napoleon_use_admonition_for_references = True
napoleon_use_ivar = True
napoleon_use_param = False
napoleon_use_rtype = False
#napoleon_use_keyword = True
# images for the gallery
nbsphinx_thumbnails = {
'irrigation/irrigation': 'irrigation/image.jpg',
'irrigation_and_rainfall/irrigation_and_rainfall': 'irrigation_and_rainfall/image.jpg',
'solarsail/solarsail-simple-version': 'solarsail/solarsail.jpeg',
'substrate/depletion': 'substrate/depletion.png',
'bacteria/bacteria': 'bacteria/maintenance.png',
......@@ -64,15 +41,6 @@ nbsphinx_thumbnails = {
'geometry2D/ellipsoid/ellipsoid': 'geometry2D/ellipsoid/ellipsoid.png',
}
#intersphinx_mapping = {
# 'python': ('https://docs.python.org/', None),
# 'numpy': ('http://docs.scipy.org/doc/numpy/', None)
#}
intersphinx_mapping = {'python': ('http://docs.python.org/', None),
'numpy': ('http://docs.scipy.org/doc/numpy', None),
'scipy': ('http://docs.scipy.org/doc/scipy/reference', None),
'matplotlib': ('http://matplotlib.sourceforge.net', None)}
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = 'sphinx'
......@@ -81,15 +49,6 @@ pygments_style = 'sphinx'
# Exclude build directory and Jupyter backup files:
exclude_patterns = ['_build', '**.ipynb_checkpoints', 'Thumbs.db', '.DS_Store']
# Default language for syntax highlighting in reST and Markdown cells:
highlight_language = 'none'
# Don't add .txt suffix to source files:
#html_sourcelink_suffix = ''
# Work-around until https://github.com/sphinx-doc/sphinx/issues/4229 is solved:
#html_scaled_image_link = False
# List of arguments to be passed to the kernel that executes the notebooks:
# If you use Matplotlib for plots, this setting is recommended:
nbsphinx_execute_arguments = [
......@@ -100,43 +59,10 @@ nbsphinx_execute_arguments = [
nbsphinx_execute = 'never'
# To get a prompt similar to the Classic Notebook, use
nbsphinx_input_prompt = ' In [%s]:'
nbsphinx_output_prompt = ' Out [%s]:'
#nbsphinx_input_prompt = ' In [%s]:'
#nbsphinx_output_prompt = ' Out [%s]:'
#nbsphinx_prompt_width = '10'
# Use a different kernel than stored in the notebook metadata, e.g.:
# nbsphinx_kernel_name = 'python3'
# Environment variables to be passed to the kernel:
#os.environ['MY_DUMMY_VARIABLE'] = 'Hello from conf.py!'
#nbsphinx_thumbnails = {
# 'gallery/thumbnail-from-conf-py': 'gallery/a-local-file.png',
# 'gallery/*-rst': '_static/copy-button.svg',
#}
# --------------------------------------------
# --------------------------------------------
# Debut : Cette partie ne fonctionne pas
# --------------------------------------------
# --------------------------------------------
## This is processed by Jinja2 and inserted before each notebook
#nbsphinx_prolog = """
#{% set docname = env.doc2path(env.docname, base=None) %}
#
#.. only:: html
#
# Mettre ici un lien vers binder, etc. Pour l'instant, je ne sais pas comment faire.
# Il faut peut-être que le projet soit public.
# On peut comme ici mettre un texte automatique pour tous les notebooks. Voir https://github.com/spatialaudio/nbsphinx/tree/0.6.0.
# On peut aussi mettre le lien binder dans le notebook directement.
#
#.. only:: latex
#
# The following section was created from :file:`{{ docname }}`.
#"""
# This is processed by Jinja2 and inserted before each notebook
nbsphinx_prolog = r"""
{% set docname = 'examples/' + env.doc2path(env.docname, base=None) %}
......@@ -145,10 +71,10 @@ nbsphinx_prolog = r"""
<div class="admonition note">
<p>Notebook source code:
<a class="reference external" href="https://gitlab.inria.fr/ct/gallery-env/-/blob/master/{{ docname|e }}">{{ docname|e }}</a>
<a class="reference external" href="https://gitlab.inria.fr/ct/gallery/-/blob/master/{{ docname|e }}">{{ docname|e }}</a>
<br>Run the notebook yourself on binder
<a href="https://mybinder.org/v2/git/https%3A%2F%2Fgitlab.inria.fr%2Fct%2Fgallery-env.git/master?urlpath=lab/tree/{{
docname|e }}"><img alt="Binder badge" src="https://static.mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>
docname|e }}"><img alt="Binder badge" src="https://static.mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>
</p>
</div>
......@@ -159,90 +85,15 @@ nbsphinx_prolog = r"""
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
"""
# <script>
# if (document.location.host) {
# var p = document.currentScript.previousSibling.previousSibling;
# var a = document.createElement('a');
# a.innerHTML = 'View in <em>nbviewer</em>';
# a.href = `https://nbviewer.jupyter.org/url${
# (window.location.protocol == 'https:' ? 's/' : '/') +
# window.location.host +
# window.location.pathname.slice(0, -4) }ipynb`;
# a.classList.add('reference');
# a.classList.add('external');
# p.appendChild(a);
# p.appendChild(document.createTextNode('.'));
# }
# </script>
#nbsphinx_prolog = """
#----
#
#Generated by nbsphinx_ from a Jupyter_ notebook.
#
#.. _nbsphinx: https://nbsphinx.readthedocs.io/
#.. _Jupyter: https://jupyter.org/
#"""
#
#nbsphinx_prolog = """
#Go there: https://example.org/notebooks/{{ env.doc2path(env.docname, base=None) }}
#
#----
#"""
#
## This is processed by Jinja2 and inserted after each notebook
#nbsphinx_epilog = r"""
#{% set docname = 'doc/' + env.doc2path(env.docname, base=None) %}
#.. raw:: latex
# \nbsphinxstopnotebook{\scriptsize\noindent\strut
# \textcolor{gray}{\dotfill\ \sphinxcode{\sphinxupquote{\strut
# {{ docname | escape_latex }}}} ends here.}}
#"""
# --------------------------------------------
# --------------------------------------------
# Fin : Cette partie ne fonctionne pas
# --------------------------------------------
# --------------------------------------------
mathjax_config = {
'TeX': {'equationNumbers': {'autoNumber': 'AMS', 'useLabelIds': True}},
}
# Additional files needed for generating LaTeX/PDF output:
#latex_additional_files = ['references.bib']
# Support for notebook formats other than .ipynb
#nbsphinx_custom_formats = {
# '.pct.py': ['jupytext.reads', {'fmt': 'py:percent'}],
#}
# ----------------------------------------------------------------------------------------
# ----------------------------------------------------------------------------------------
# -- The settings below this line are not specific to nbsphinx ------------
#
# where we stop the documentation: when coming to fortran files
#autodoc_mock_imports = ['nutopy.mod_nlesolve',
# 'nutopy.mod_ivpsolve',
# 'nutopy.mod_pathsolve',
# ]
# Default processing flags for sphinx
autoclass_content = 'class'
autodoc_member_order = 'bysource'
autodoc_default_options = {
'members': True,
'undoc-members':True,
'show-inheritance':True
}
#autodoc_member_order = 'alphabetical' #'bysource'
add_module_names = False
add_function_parentheses = False
# The suffix(es) of source filenames.
source_suffix = {
'.rst': 'restructuredtext',
......@@ -250,40 +101,52 @@ source_suffix = {
}
#---sphinx-themes-----
html_theme = 'sphinx_rtd_theme'
html_theme = 'pydata_sphinx_theme'
# options for sphinx_rtd_theme: see https://sphinx-rtd-theme.readthedocs.io/en/stable/configuring.html#
html_theme_options = {
'canonical_url': '',
# 'analytics_id': 'UA-XXXXXXX-1', # Provided by Google in your dashboard
'logo_only': False,
'display_version': False,
'prev_next_buttons_location': 'bottom',
'style_external_links': False,
# 'style_nav_header_background': 'white',
# Toc options
'collapse_navigation': True,
'sticky_navigation': True,
'navigation_depth': 4,
'includehidden': True,
'titles_only': False
# "collapse_navigation": True,
"navigation_depth": 1,
"show_toc_level": 1,
"use_edit_page_button": True,
"external_links": [
{"url": "https://ct.gitlabpages.inria.fr/bocop3/", "name": "Bocop Docs"},
{"url": "https://ct.gitlabpages.inria.fr/nutopy/", "name": "Nutopy Docs"}
],
"gitlab_url": "https://gitlab.inria.fr/ct/gallery",
"navbar_align": "left", # [left, content, right] For testing that the navbar items align properly
"navbar_end": ["search-field", "navbar-icon-links"], # Just for testing
"search_bar_text": "Search...",
#"page_sidebar_items": ["page-toc", "edit-this-page"],
#"footer_items": ["copyright", "sphinx-version", ""]
}
# Remove the sidebar from some pages
html_sidebars = {
# "**": [],
"**": ["sidebar-nav-bs", "sidebar-ethical-ads"],
# "notebooks": ["sidebar-ethical-ads"],
}
html_context = {
"gitlab_url": "https://gitlab.inria.fr", # or your self-hosted GitLab
"gitlab_user": "ct",
"gitlab_repo": "gallery",
"gitlab_version": "master",
"doc_path": "examples",
}
html_logo = 'logo-ct.svg'
author = 'Olivier Cots'
project = u'control toolbox gallery'
import time
copyright = u'%s, ct gallery project.' % time.strftime('%Y') # a changer
copyright = u'%s, ct gallery project' % time.strftime('%Y') # a changer
#version = '0.2' # a voir comment gerer doc et version
#release = '0.2.1'
html_logo = 'logo-ct.svg'
master_doc = 'index'
# Grab the setup entry
#distribution = pkg_resources.require(project)[0]
#linkcheck_ignore = [r'http://localhost:\d+/']
# -- Get version information and date from Git ----------------------------
......@@ -299,50 +162,4 @@ except Exception:
# -- Options for HTML output ----------------------------------------------
html_title = project #+ ' version ' + release
# -- Options for LaTeX output ---------------------------------------------
# See https://www.sphinx-doc.org/en/master/latex.html
#latex_elements = {
# 'papersize': 'a4paper',
# 'printindex': '',
# 'sphinxsetup': r"""
# %verbatimwithframe=false,
# %verbatimwrapslines=false,
# %verbatimhintsturnover=false,
# VerbatimColor={HTML}{F5F5F5},
# VerbatimBorderColor={HTML}{E0E0E0},
# noteBorderColor={HTML}{E0E0E0},
# noteborder=1.5pt,
# warningBorderColor={HTML}{E0E0E0},
# warningborder=1.5pt,
# warningBgColor={HTML}{FBFBFB},
# """,
# 'preamble': r"""
#\usepackage[sc,osf]{mathpazo}
#\linespread{1.05} % see http://www.tug.dk/FontCatalogue/urwpalladio/
#\renewcommand{\sfdefault}{pplj} % Palatino instead of sans serif
#\IfFileExists{zlmtt.sty}{
# \usepackage[light,scaled=1.05]{zlmtt} % light typewriter font from lmodern
#}{
# \renewcommand{\ttdefault}{lmtt} % typewriter font from lmodern
#}
#\usepackage{booktabs} % for Pandas dataframes
#""",
#}
#
#latex_documents = [
# (master_doc, 'nbsphinx.tex', project, author, 'howto'),
#]
#
#latex_show_urls = 'footnote'
#latex_show_pagerefs = True
# -- Options for EPUB output ----------------------------------------------
# These are just defined to avoid Sphinx warnings related to EPUB:
version = release
#suppress_warnings = ['epub.unknown_project_files']
html_title = "ct gallery" #+ ' version ' + release
# gfun
TAPENADE_HOME=/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8 \
/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8/bin/tapenade -tangent -fixinterface \
-inputlanguage fortran90 -outputlanguage fortran90 -O ./ -tgtfuncname _d -head "gfun(x)>(g)" \
-o gfun \
gfun.f90
# gfun_d
TAPENADE_HOME=/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8 \
/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8/bin/tapenade -tangent -fixinterface \
-inputlanguage fortran90 -outputlanguage fortran90 -O ./ -tgtfuncname _d -head "gfun_d(x)>(g, gd)" \
-o gfun_d \
gfun_d.f90
# hfun
TAPENADE_HOME=/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8 \
/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8/bin/tapenade -tangent -fixinterface \
......@@ -27,3 +12,10 @@ TAPENADE_HOME=/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/ins
-o hfun_d \
hfun_d.f90
# hfun
TAPENADE_HOME=/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8 \
/Users/ocots/Boulot/recherche/Logiciels/dev/hampath/hampath308/install/tapenade3.8/bin/tapenade -tangent -fixinterface \
-inputlanguage fortran90 -outputlanguage fortran90 -O ./ -tgtfuncname _d -head "hfun_d_d(x, p)>(hdd)" \
-o hfun_d_d \
hfun_d_d.f90
This diff is collapsed.
subroutine gfun(x, a, b, c, g)
double precision, intent(in) :: x(2), a, b, c
double precision, intent(out) :: g(2)
double precision :: l1, l2, th1, th2
th1 = x(1)
th2 = x(2)
l1 = a * sin(th1)**2 + b * cos(th1)**2
l2 = b * cos(th2)**2 + c * sin(th2)**2
g(1) = (l1-l2)*l1/(l1-c)
g(2) = (l1-l2)*l2/(a-l2)
end subroutine gfun
! Generated by TAPENADE (INRIA, Tropics team)
! Tapenade 3.8 (r4996) - 25 Oct 2013 15:08
!
! Differentiation of gfun in forward (tangent) mode (with options fixinterface):
! variations of useful results: g
! with respect to varying inputs: x
! RW status of diff variables: g:out x:in
SUBROUTINE GFUN_D(x, xd, a, b, c, g, gd)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: x(2), a, b, c
DOUBLE PRECISION, INTENT(IN) :: xd(2)
DOUBLE PRECISION, INTENT(OUT) :: g(2)
DOUBLE PRECISION, INTENT(OUT) :: gd(2)
DOUBLE PRECISION :: l1, l2, th1, th2
DOUBLE PRECISION :: l1d, l2d, th1d, th2d
INTRINSIC SIN
INTRINSIC COS
th1d = xd(1)
th1 = x(1)
th2d = xd(2)
th2 = x(2)
l1d = a*2*SIN(th1)*th1d*COS(th1) - b*2*COS(th1)*th1d*SIN(th1)
l1 = a*SIN(th1)**2 + b*COS(th1)**2
l2d = c*2*SIN(th2)*th2d*COS(th2) - b*2*COS(th2)*th2d*SIN(th2)
l2 = b*COS(th2)**2 + c*SIN(th2)**2
gd = 0.D0
gd(1) = (((l1d-l2d)*l1+(l1-l2)*l1d)*(l1-c)-(l1-l2)*l1*l1d)/(l1-c)**2
g(1) = (l1-l2)*l1/(l1-c)
gd(2) = (((l1d-l2d)*l2+(l1-l2)*l2d)*(a-l2)+(l1-l2)*l2*l2d)/(a-l2)**2
g(2) = (l1-l2)*l2/(a-l2)
END SUBROUTINE GFUN_D
! Generated by TAPENADE (INRIA, Tropics team)
! Tapenade 3.8 (r4996) - 25 Oct 2013 15:08
!
! Differentiation of gfun_d in forward (tangent) mode (with options fixinterface):
! variations of useful results: g gd
! with respect to varying inputs: x
! RW status of diff variables: g:out x:in gd:out
! Generated by TAPENADE (INRIA, Tropics team)
! Tapenade 3.8 (r4996) - 25 Oct 2013 15:08
!
! Differentiation of gfun in forward (tangent) mode (with options fixinterface):
! variations of useful results: g
! with respect to varying inputs: x
! RW status of diff variables: g:out x:in
SUBROUTINE GFUN_D_D(x, xd, xd0, a, b, c, g, gd, gd0, gdd)
IMPLICIT NONE
DOUBLE PRECISION, INTENT(IN) :: x(2), a, b, c
DOUBLE PRECISION, INTENT(IN) :: xd0(2)
DOUBLE PRECISION, INTENT(IN) :: xd(2)
DOUBLE PRECISION, INTENT(OUT) :: g(2)
DOUBLE PRECISION, INTENT(OUT) :: gd0(2)
DOUBLE PRECISION, INTENT(OUT) :: gd(2)
DOUBLE PRECISION, INTENT(OUT) :: gdd(2)
DOUBLE PRECISION :: l1, l2, th1, th2
DOUBLE PRECISION :: l1d0, l2d0, th1d0, th2d0
DOUBLE PRECISION :: l1d, l2d, th1d, th2d
DOUBLE PRECISION :: l1dd, l2dd
INTRINSIC SIN
INTRINSIC COS
th1d = xd(1)
th1d0 = xd0(1)
th1 = x(1)
th2d = xd(2)
th2d0 = xd0(2)
th2 = x(2)
l1dd = a*2*th1d*(th1d0*COS(th1)**2-SIN(th1)**2*th1d0) - b*2*th1d*(COS(&
& th1)**2*th1d0-th1d0*SIN(th1)**2)
l1d = a*2*SIN(th1)*th1d*COS(th1) - b*2*COS(th1)*th1d*SIN(th1)
l1d0 = a*2*SIN(th1)*th1d0*COS(th1) - b*2*COS(th1)*th1d0*SIN(th1)
l1 = a*SIN(th1)**2 + b*COS(th1)**2
l2dd = c*2*th2d*(th2d0*COS(th2)**2-SIN(th2)**2*th2d0) - b*2*th2d*(COS(&
& th2)**2*th2d0-th2d0*SIN(th2)**2)
l2d = c*2*SIN(th2)*th2d*COS(th2) - b*2*COS(th2)*th2d*SIN(th2)
l2d0 = c*2*SIN(th2)*th2d0*COS(th2) - b*2*COS(th2)*th2d0*SIN(th2)
l2 = b*COS(th2)**2 + c*SIN(th2)**2
gd = 0.d0
gdd = 0.D0
gdd(1) = ((((l1dd-l2dd)*l1+(l1d-l2d)*l1d0+(l1d0-l2d0)*l1d+(l1-l2)*l1dd&
& )*(l1-c)+((l1d-l2d)*l1+(l1-l2)*l1d)*l1d0-(l1d0-l2d0)*l1*l1d-(l1-l2)*&
& (l1d0*l1d+l1*l1dd))*(l1-c)**2-(((l1d-l2d)*l1+(l1-l2)*l1d)*(l1-c)-(l1&
& -l2)*l1*l1d)*2*(l1-c)*l1d0)/((l1-c)**2)**2
gd(1) = (((l1d-l2d)*l1+(l1-l2)*l1d)*(l1-c)-(l1-l2)*l1*l1d)/(l1-c)**2
gd0 = 0.D0
gd0(1) = (((l1d0-l2d0)*l1+(l1-l2)*l1d0)*(l1-c)-(l1-l2)*l1*l1d0)/(l1-c)&
& **2
g(1) = (l1-l2)*l1/(l1-c)
gdd(2) = ((((l1dd-l2dd)*l2+(l1d-l2d)*l2d0+(l1d0-l2d0)*l2d+(l1-l2)*l2dd&
& )*(a-l2)-((l1d-l2d)*l2+(l1-l2)*l2d)*l2d0+(l1d0-l2d0)*l2*l2d+(l1-l2)*&
& (l2d0*l2d+l2*l2dd))*(a-l2)**2+(((l1d-l2d)*l2+(l1-l2)*l2d)*(a-l2)+(l1&
& -l2)*l2*l2d)*2*(a-l2)*l2d0)/((a-l2)**2)**2
gd(2) = (((l1d-l2d)*l2+(l1-l2)*l2d)*(a-l2)+(l1-l2)*l2*l2d)/(a-l2)**2
gd0(2) = (((l1d0-l2d0)*l2+(l1-l2)*l2d0)*(a-l2)+(l1-l2)*l2*l2d0)/(a-l2)&
& **2
g(2) = (l1-l2)*l2/(a-l2)
END SUBROUTINE GFUN_D_D
subroutine hfun(x, p, h, gfun)
subroutine hfun(x, p, a, b, c, h)
double precision, intent(in) :: x(2), p(2)
double precision, intent(in) :: x(2), p(2), a, b, c
double precision, intent(out) :: h
interface
subroutine gfun(x, g)
double precision, intent(in) :: x(2)
double precision, intent(out) :: g(2)
end subroutine gfun
end interface
! local variables
double precision :: g(2), p1, p2
double precision :: p1, p2
double precision :: l1, l2, th1, th2, f1, f2
p1 = p(1)
p2 = p(2)
call gfun(x, g)
th1 = x(1)
th2 = x(2)
l1 = a * sin(th1)**2 + b * cos(th1)**2
l2 = b * cos(th2)**2 + c * sin(th2)**2
f1 = (l1-c)/((l1-l2)*l1)
f2 = (a-l2)/((l1-l2)*l2)
h = 0.5d0 * (p1**2 / g(1