###########################################################
# Explanation of the format for multipatch geometry files #
###########################################################
#
# The file starts with a header containing information about the file,
#  formed by an arbitrary number of lines starting with the symbol "#".
#
# HEADER
# file: geo_specs_mp_v21.txt
# nurbs geometry v.2.1
#
# Thick L-shaped domain, defined with three patches. The patch in the middle 
#  (Patch 2) has been rotated with respect to the reference domain.
# Patches 1 and 3 belong to subdomain 1. Patch 2 belongs to subdomain 2.
# The faces adjacent to the reentrant edge have reference numbers 1 and 2.
# The other boundary faces have reference number from 3 to 8.
# Jun 22nd 2015
#
#
# The first line after the header consists of four integer values
#   ndim rdim Np Ni Ns     (4 integer values)
#
#  ndim : dimension of the parametric domain
#  rdim : dimension of the physical domain
#  Np:    number of patches to construct the geometry
#  Ni:    total number of interfaces, each one connecting two patches
#  Ns:    total number of subdomains, formed by the union of patches
3 3 3 2 2
#
# Then follows the information for each patch. This consists of the following:
#
# The name of the patch (string)
PATCH 1
#
# p(i): the degree in each Cartesian direction (ndim integers)
1 1 1
#
# ncp(i): the number of control points in each direction (ndim integers)
2 2 2
#
# knots{i}: knot sequence in the Cartesian direction (ncp(i)+p(i)+1 floats)
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
#
# cp_x, cp_y, cp_z: coordinates of the control points in HOMOGENEOUS COORDINATES
#                    sometimes also called weighted control points
#                   (see Section 4.2 of The NURBS Book, L. Piegl & W. Tiller)
#   (N rows, each one with prod_{i=1}^{rdim} ncp(i) float values)
#
# The control points are numbered in a reverse lexicographic order: starting
#  from the origin, we first increase the parametric coordinate x_1 and then 
#  the parametric coordinate x_2 (and for 3D cases, then the coordinate x_3).
-1.0000   0.00000  -1.00000   0.00000  -1.00000   0.00000  -1.00000   0.00000
-1.0000  -1.00000   0.00000   0.00000  -1.00000  -1.00000   0.00000   0.00000
0.00000   0.00000   0.00000   0.00000   1.00000   1.00000   1.00000   1.00000
#
# weights: weight associated to each basis function (or control point)
#          (prod_{i=1}^{ndim} ncp(i) float values)
1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000
#
# An analogous description is given for the other patches
#
PATCH 2
# Degree and number of control points
1 1 1
2 2 2
# Knot vectors
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
# Weighted control points and weights. Notice that this patch is rotated.
0.00000  -1.00000   0.00000  -1.00000   0.00000  -1.00000   0.00000  -1.00000
0.00000   0.00000   1.00000   1.00000   0.00000   0.00000   1.00000   1.00000
1.00000   1.00000   1.00000   1.00000   0.00000   0.00000   0.00000   0.00000
1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000
PATCH 3
# Degree and number of control points
1 1 1
2 2 2
# Knot vectors
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   1.00000   1.00000
# Weighted control points and weights
0.00000   1.00000   0.00000   1.00000   0.00000   1.00000   0.00000   1.00000
0.00000   0.00000   1.00000   1.00000   0.00000   0.00000   1.00000   1.00000
0.00000   0.00000   0.00000   0.00000   1.00000   1.00000   1.00000   1.00000
1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000   1.00000
#
# Then Ni records with the information for each interface:
#
# The name of the interface
#
INTERFACE 1
#
# patch1 side1 (2 integer values)
#   patch1: patch to which the first face (or edge) belongs
#   side1:  local number of the face (or edge) in the patch
# A more detailed explanation is given at the end of the file.
#
1 4
#
# patch2 side2 (2 integer values)
#   patch2: patch to which the second face (or edge) belongs
#   side2:  local number of the face (or edge) in the patch
# A more detailed explanation is given at the end of the file.
#
2 3
#
#  For 2D multipatch geometries (not this case)
#
# ornt (1 integer value)
#  Information to see how the two edges match
#
#  For 3D multipatch geometries (this case)
#
# flag ornt1 ornt2 (3 integer values)
#  Information to see how the two faces match
# A more detailed explanation is given at the end of the file.
#
1 -1 -1
#
# And the same information is given for all the other interfaces
#
INTERFACE 2
2 1
3 1
1 1 -1
#
# Finally we add the information related to the physical problem.
#
# We add Ns records with the patches belonging to each subdomain:
#
# The name of the subdomain (string)
SUBDOMAIN 1
#
# The patches that belong to the subdomain (array of integer values)
1 3
#
# And the same for the other subdomains
#
SUBDOMAIN 2
2
#
# For the boundary conditions, we add as many records as physical boundaries: 
#
# The name of the boundary (string)
BOUNDARY 1
#
# nsides: the number of sides on the boundary (integer values)
1
#
# nsides rows containing the following information for each side:
#  patch side  (2 integer values)
#   patch: patch to which this side (face or edge) belongs
#   side:  local number of the side in the patch
#  A more detailed explanation is given at the end of the file
#
1 2
#
# The same information is given for the other boundaries
#
BOUNDARY 2
1
3 3
BOUNDARY 3
1
1 3
BOUNDARY 4
1
3 2
BOUNDARY 5
2
1 1
2 2
BOUNDARY 6
2
2 4
3 4
BOUNDARY 7
3
1 5
2 6
3 5
BOUNDARY 8
3
1 6
2 5
3 6
#
#
# DETAILED EXPLANATIONS
#
# For the interfaces and boundary information, it is necessary to assign a 
#  a number to each side. We assign a number to each side of the parametric 
#  domain, which is inherited by the boundaries of the physical one. The 
#  numbers assigned in the parametric domain are the following
#
#            2D CASE                        3D CASE
#    Edge 1, {(u,v) : u = 0} (left)    Face 1, {(u,v,w) : u = 0} (left)
#    Edge 2, {(u,v) : u = 1} (right)   Face 2, {(u,v,w) : u = 1} (right)
#    Edge 3, {(u,v) : v = 0} (bottom)  Face 3, {(u,v,w) : v = 0} (front)
#    Edge 4, {(u,v) : v = 1} (top)     Face 4, {(u,v,w) : v = 1} (back)
#                                      Face 5, {(u,v,w) : w = 0} (bottom)
#                                      Face 6, {(u,v,w) : w = 1} (top)
#
# For multipatch geometries, it is necessary to give the information about how
#  the patches match on the interfaces. The format we propose is based on the 
#  paper:
#   [1] T. Dokken, E. Quak, V. Skytt. Requirements from Isogeometric Analysis 
#       for changes in product design ontologies, 2010.
# 
#
# The explanation of the fields of the interface is the following:
#
# patch1: number of the first patch on the coinciding boundary interface.
# side1:  the boundary surface index on patch1, for the coinciding surface/edge.
#
# patch2: number of the second patch on the coinciding boundary interface.
# side2:  the boundary surface index on patch2, for the coinciding surface/edge.
#
#  For 2D multipatch geometries
#
# ornt:  a flag telling if the parameter direction on the edge of patch1 matches
#         the parameter direction on the edge of patch2.
#
#  For 3D multipatch geometries
#
# flag:  a flag telling if the two parameter coordinates on side1 coincide 
#         with the two parameter coordinates on side2 (the first coordinate
#         in one side is also the first in the other, and the same for the second)
# ornt1: a flag telling if the first parameter direction on side1 matches the 
#         corresponding parameter direction on side2.
# ornt2: a flag telling if the second parameter direction on side1 matches the
#         corresponding parameter direction on side2.
#
#
#
# GEOMETRY OF THIS EXAMPLE
#
#  The geometry is a three-dimensional thick L-shaped domain, with coordinates
#
#   Omega = [(-1,1) x (-1,1) x (0,1)] \ [(0,1) x (-1,0) x (0,1)].
#
#  It is defined with three patches, which correspond to the coordinates
#
#   Patch_1 = (-1,0) x (-1,0) x (0,1)
#   Patch_2 = (-1,0) x  (0,1) x (0,1)
#   Patch_3 =  (0,1) x  (0,1) x (0,1)
#
#  The first and third patches are translations of the reference domain.
#  The second patch has been rotated, to show the information for interfaces.
#  The first interface matches the first and second patches.
#  The second interface matches the second and third patches.
#  The exterior boundaries are as follows:
#
#   Gamma_1 = {0}    x (-1,0) x (0,1)
#   Gamma_2 = (0,1)  x   {0}  x (0,1)
#   Gamma_3 = (-1,0) x  {-1}  x (0,1)
#   Gamma_4 = {1}    x  (0,1) x (0,1)
#   Gamma_5 = {-1}   x (-1,1) x (0,1)
#   Gamma_6 = (-1,1) x   {1}  x (0,1)
#   Gamma_7 = [(-1,1)^2 \ [(0,1) x (-1,0)]] x {0} (lower part)
#   Gamma_8 = [(-1,1)^2 \ [(0,1) x (-1,0)]] x {1} (upper part)
#
