Commits

Andre Massing  committed ec5cef8 Merge

Merge branch 'master' into massing/topic-ccfem

  • Participants
  • Parent commits 2d595a5, 55bf4b0
  • Branches massing/topic-ccfem

Comments (0)

Files changed (147)

   Jan Blechta           <blechta@karlin.mff.cuni.cz>        (C)
   Rolv Erlend Bredesen  <rolv@simula.no>                    (C)
   Jed Brown             <fenics@59A2.org>                   (C)
+  Solveig Bruvoll       <solveio@ifi.uio.no>                (C)
   Niklas Ericsson       <nen@math.chalmers.se>              (-)
   Patrick Farrell       <patrick.farrell06@imperial.ac.uk>  (C)
   Georgios Foufas       <foufas@math.chalmers.se>           (C)
   Kent-Andre Mardal     <kent-and@simula.no>                (C)
   Andreas Mark          <f00anma@dd.chalmers.se>            (-)
   Andre Massing         <massing@simula.no>                 (C)
+  Lawrence Mitchell     <lawrence.mitchell@imperial.ac.uk>  (C)
   Marco Morandini       <morandini@aero.polimi.it>          (C)
   Mikael Mortensen      <mikael.mortensen@gmail.com>        (C)
+  Corrado Maurini       <cmaurini@gmail.com>                (C)
   Pablo De Napoli       <pdenapo@gmail.com>                 (-)
   Harish Narayanan      <hnarayanan@gmail.com>              (C)
   Andreas Nilsson       <f99anni@dd.chalmers.se>            (-)

File CMakeLists.txt

 set(DOLFIN_VERSION "${DOLFIN_VERSION_MAJOR}.${DOLFIN_VERSION_MINOR}.${DOLFIN_VERSION_MICRO}")
 
 #------------------------------------------------------------------------------
+# Get GIT changeset, if available
+
+# Check for git
+find_program(GIT_FOUND git)
+
+if (GIT_FOUND)
+  # Get the commit hash of the working branch
+  execute_process(COMMAND git rev-parse HEAD
+    WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
+    OUTPUT_VARIABLE GIT_COMMIT_HASH
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+else()
+  set(GIT_COMMIT_HASH "unknown")
+endif()
+
+#------------------------------------------------------------------------------
 # General configuration
 
 # Set CMake options, see `cmake --help-policy CMP000x`
 #       is used to get the installation path for dolfin_utils
 find_package(PythonInterp 2)
 if (DOLFIN_ENABLE_PYTHON)
-  find_package(PythonLibs 2)
+
+  # Set variables to help find Python library that is compatible with
+  # interpreter
+  if (PYTHONINTERP_FOUND)
+    # Get Python include path from Python interpretter
+    execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+                           "import distutils.sysconfig, sys; sys.stdout.write(distutils.sysconfig.get_python_inc())"
+                    OUTPUT_VARIABLE _PYTHON_INCLUDE_PATH
+                    RESULT_VARIABLE _PYTHON_INCLUDE_RESULT)
+
+    # Get Python library path from interpreter
+    execute_process(COMMAND "${PYTHON_EXECUTABLE}" -c
+                          "import os, sys, inspect; sys.stdout.write(os.path.split(os.path.split(inspect.getfile(inspect))[0])[0])"
+                    OUTPUT_VARIABLE _PYTHON_LIB_PATH
+                    RESULT_VARIABLE _PYTHON_LIB_RESULT)
+
+    # Set include path, if returned by interpreter
+    if ("${_PYTHON_INCLUDE_RESULT}" STREQUAL "0")
+      set(PYTHON_INCLUDE_DIR ${_PYTHON_INCLUDE_PATH})
+    endif()
+
+    # Add a search path for Python library based on output from
+    # iterpreter
+    if ("${_PYTHON_LIB_RESULT}" STREQUAL "0")
+      set(CMAKE_LIBRARY_PATH ${_PYTHON_LIB_PATH})
+    endif()
+
+    # Find Pythons livs
+    find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET REQUIRED)
+  endif()
 
   # If Python is found, check for NumPy and SWIG
   if (PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
                ${CMAKE_BINARY_DIR}/dolfin-version @ONLY)
 install(FILES ${CMAKE_BINARY_DIR}/dolfin-version
         DESTINATION ${DOLFIN_BIN_DIR}
-	PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
+	PERMISSIONS OWNER_WRITE OWNER_READ GROUP_READ WORLD_READ
+        OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
         COMPONENT RuntimeExecutables)
 
 #------------------------------------------------------------------------------
+ - Feature: Enable assignment of sparse MeshValueCollections to MeshFunctions
+ - Feature: Add free function assign that is used for sub function assignment
+ - Feature: Add class FunctionAssigner that cache dofs for sub function assignment
  - Fix runtime dependency on checking swig version
  - Deprecate DofMap member methods vertex_to_dof_map and dof_to_vertex_map
  - Add free functions: vertex_to_dof_map and dof_to_vertex_map, and correct the ordering of the map.

File bench/fem/convergence/cpp/Poisson2D_1.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 2D for q = 1
+
+element = FiniteElement("Lagrange", triangle, 1)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson2D_2.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 2D for q = 2
+
+element = FiniteElement("Lagrange", triangle, 2)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson2D_3.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 2D for q = 3
+
+element = FiniteElement("Lagrange", triangle, 3)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson2D_4.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 2D for q = 4
+
+element = FiniteElement("Lagrange", triangle, 4)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson2D_5.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 2D for q = 5
+
+element = FiniteElement("Lagrange", triangle, 5)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson3D_1.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 3D for q = 1
+
+element = FiniteElement("Lagrange", tetrahedron, 1)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson3D_2.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#    
+# Poisson's equation in 3D for q = 2
+
+element = FiniteElement("Lagrange", tetrahedron, 2)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson3D_3.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 3D for q = 3
+
+element = FiniteElement("Lagrange", tetrahedron, 3)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson3D_4.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 3D for q = 4
+
+element = FiniteElement("Lagrange", tetrahedron, 4)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/Poisson3D_5.ufl

+# Copyright (C) 2005-2006 Anders Logg
+#
+# This file is part of DOLFIN.
+#
+# DOLFIN is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# DOLFIN is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
+#
+# First added:  2005
+# Last changed: 2006-03-28
+#
+# Poisson's equation in 3D for q = 5
+
+element = FiniteElement("Lagrange", tetrahedron, 5)
+
+v = TestFunction(element)
+U = TrialFunction(element)
+f = Coefficient(element)
+
+a = v.dx(i)*U.dx(i)*dx
+L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson2D_1.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 2D for q = 1
-
-element = FiniteElement("Lagrange", triangle, 1)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson2D_2.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 2D for q = 2
-
-element = FiniteElement("Lagrange", triangle, 2)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson2D_3.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 2D for q = 3
-
-element = FiniteElement("Lagrange", triangle, 3)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson2D_4.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 2D for q = 4
-
-element = FiniteElement("Lagrange", triangle, 4)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson2D_5.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 2D for q = 5
-
-element = FiniteElement("Lagrange", triangle, 5)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson3D_1.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 3D for q = 1
-
-element = FiniteElement("Lagrange", tetrahedron, 1)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson3D_2.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#    
-# Poisson's equation in 3D for q = 2
-
-element = FiniteElement("Lagrange", tetrahedron, 2)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson3D_3.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 3D for q = 3
-
-element = FiniteElement("Lagrange", tetrahedron, 3)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson3D_4.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 3D for q = 4
-
-element = FiniteElement("Lagrange", tetrahedron, 4)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/forms/Poisson3D_5.ufl

-# Copyright (C) 2005-2006 Anders Logg
-#
-# This file is part of DOLFIN.
-#
-# DOLFIN is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# DOLFIN is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
-#
-# First added:  2005
-# Last changed: 2006-03-28
-#
-# Poisson's equation in 3D for q = 5
-
-element = FiniteElement("Lagrange", tetrahedron, 5)
-
-v = TestFunction(element)
-U = TrialFunction(element)
-f = Coefficient(element)
-
-a = v.dx(i)*U.dx(i)*dx
-L = v*f*dx

File bench/fem/convergence/cpp/main.cpp

 // Last changed: 2011-09-21
 
 #include <dolfin.h>
-#include "forms/Poisson2D_1.h"
-#include "forms/Poisson2D_2.h"
-#include "forms/Poisson2D_3.h"
-#include "forms/Poisson2D_4.h"
-#include "forms/Poisson2D_5.h"
-#include "forms/Poisson3D_1.h"
-#include "forms/Poisson3D_2.h"
-#include "forms/Poisson3D_3.h"
-#include "forms/Poisson3D_4.h"
-#include "forms/Poisson3D_5.h"
+#include "Poisson2D_1.h"
+#include "Poisson2D_2.h"
+#include "Poisson2D_3.h"
+#include "Poisson2D_4.h"
+#include "Poisson2D_5.h"
+#include "Poisson3D_1.h"
+#include "Poisson3D_2.h"
+#include "Poisson3D_3.h"
+#include "Poisson3D_4.h"
+#include "Poisson3D_5.h"
 
 using namespace dolfin;
 
 class DirichletBoundary : public SubDomain
 {
   bool inside(const Array<double>& x, bool on_boundary) const
-  {
-    return on_boundary;
-  }
+  { return on_boundary; }
 };
 
 // Right-hand side, 2D

File cmake/modules/FindTAO.cmake

 
   find_library(TAO_LIBRARY
     NAMES tao
-    HINTS ${TAO_DIR}/lib $ENV{TAO_DIR}/lib  ${TAO_DIR}/${PETSC_ARCH}/lib $ENV{TAO_DIR}/$ENV{PETSC_ARCH}/lib 
+    HINTS ${TAO_DIR}/lib $ENV{TAO_DIR}/lib  ${TAO_DIR}/${PETSC_ARCH}/lib $ENV{TAO_DIR}/$ENV{PETSC_ARCH}/lib
     DOC "The TAO library"
     )
   mark_as_advanced(TAO_LIBRARY)
 PETSC_ARCH = ${PETSC_ARCH}
 PETSC_DIR = ${PETSC_DIR}
 include ${TAO_DIR}/conf/tao_base
-show :
+showvar :
 	-@echo -n \${\${VARIABLE}}
 ")
 
   # Define macro for getting TAO variables from Makefile
   macro(TAO_GET_VARIABLE var name)
     set(${var} "NOTFOUND" CACHE INTERNAL "Cleared" FORCE)
-    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${tao_config_makefile} show VARIABLE=${name}
+    execute_process(COMMAND ${CMAKE_MAKE_PROGRAM} --no-print-directory -f ${tao_config_makefile} showvar VARIABLE=${name}
       OUTPUT_VARIABLE ${var}
       RESULT_VARIABLE tao_return)
   endmacro()
     set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${MPI_C_LIBRARIES} ${BLAS_LIBRARIES})
     set(CMAKE_REQUIRED_FLAGS     "${CMAKE_REQUIRED_FLAGS}${MPI_C_LIBRARIES} ${BLAS_LIBRARIES}")
   endif()
-  
+
   # Run TAO test program
   set(TAO_TEST_LIB_CPP
     "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/tao_test_lib.cpp")

File cmake/scripts/download-demo-data

 }
 
 download_mesh demo/documented/eigenvalue                     box_with_dent.xml.gz
-download_mesh demo/undocumented/meshfunction                 unitsquare_2_2.xml.gz
-download_mesh demo/undocumented/meshfunction                 unitsquare_2_2_subdomains.xml.gz
 download_mesh demo/undocumented/mixed-poisson-sphere         sphere_16.xml.gz
 download_mesh demo/undocumented/advection-diffusion          dolfin_fine.xml.gz
 download_mesh demo/undocumented/advection-diffusion          dolfin_fine_velocity.xml.gz
 download_mesh demo/undocumented/advection-diffusion          dolfin_fine_subdomains.xml.gz
+download_mesh demo/undocumented/contact-vi-snes              circle_yplane.xml.gz
+download_mesh demo/undocumented/contact-vi-tao               circle_yplane.xml.gz
 download_mesh demo/undocumented/multistage-solver            dolfin_fine.xml.gz
 download_mesh demo/undocumented/multistage-solver            dolfin_fine_velocity.xml.gz
 download_mesh demo/undocumented/multistage-solver            dolfin_fine_subdomains.xml.gz
 download_mesh demo/documented/tensor-weighted-poisson        unitsquare_32_32_c11.xml.gz
 download_mesh demo/documented/stokes-taylor-hood/            dolfin_fine.xml.gz
 download_mesh demo/documented/stokes-taylor-hood             dolfin_fine_subdomains.xml.gz
-download_mesh demo/undocumented/stokes-taylor-hood           dolfin_fine.xml.gz
 download_mesh demo/undocumented/elastodynamics               dolfin_fine.xml.gz
 download_mesh demo/undocumented/auto-adaptive-navier-stokes  channel_with_flap.xml.gz
 download_mesh demo/documented/stokes-mini                    dolfin_fine.xml.gz

File cmake/scripts/generate-form-files

 # Forms that need special options
 special = {"CahnHilliard2D.ufl":       "-fsplit",
            "CahnHilliard3D.ufl":       "-fsplit",
+           "Poisson2D_1.ufl":         "-fsplit",
+           "Poisson2D_2.ufl":         "-fsplit",
+           "Poisson2D_3.ufl":         "-fsplit",
+           "Poisson2D_4.ufl":         "-fsplit",
+           "Poisson2D_5.ufl":         "-fsplit",
+           "Poisson3D_1.ufl":         "-fsplit",
+           "Poisson3D_2.ufl":         "-fsplit",
+           "Poisson3D_3.ufl":         "-fsplit",
+           "Poisson3D_4.ufl":         "-fsplit",
+           "Poisson3D_5.ufl":         "-fsplit",
            "AdaptivePoisson.ufl":      "-e",
            "AdaptiveNavierStokes.ufl": "-e"}
 

File demo/documented/bcs/cpp/main.cpp

   DirichletBC bc3(V, u3, 3);
   std::vector<const DirichletBC*> bcs = boost::assign::list_of(&bc0)(&bc1)(&bc2)(&bc3);
 
+  // Set PETSc MUMPS paramter (this is required to prevent a memory
+  // error in some cases when using MUMPS LU solver).
+  #ifdef HAS_PETSC
+  PETScOptions::set("mat_mumps_icntl_14", 40.0);
+  #endif
+
   // Compute solution
   Function u(V);
   solve(a == L, u, bcs);

File demo/documented/bcs/python/demo_bcs.py

 bc2 = DirichletBC(V, u2, 2)
 bc3 = DirichletBC(V, u3, 3)
 
+# Set PETSc MUMPS paramter (this is required to prevent a memory error
+# in some cases when using MUMPS LU solver).
+if has_petsc():
+    PETScOptions.set("mat_mumps_icntl_14", 40.0)
+
 # Compute solution
 u = Function(V)
 solve(a == L, u, [bc0, bc1, bc2, bc3])

File demo/documented/built-in_meshes/common.txt

-
 This demo illustrates:
 
-* How to define some of the different built-in meshes in dolfin
-
-
+* How to define some of the different built-in meshes in DOLFIN
 
 Problem definition
 ------------------
 
-We do not have any equation in this demo. The demo focuses purely on the built-in meshes. We will look at the following meshes:
+The demo focuses on the built-in meshes. We will look at the following
+meshes:
 
 * :py:class:`UnitIntervalMesh <dolfin.cpp.mesh.UnitIntervalMesh>`
 * :py:class:`UnitSquareMesh <dolfin.cpp.mesh.UnitSquareMesh>`

File demo/documented/built-in_meshes/cpp/main.cpp

   info("Plotting a RectangleMesh");
   plot(rectangle_right_left, "Rectangle (right/left)");
 
-  UnitCircleMesh circle_rotsumn(20, "right", "rotsumn");
-  info("Plotting a UnitCircleMesh");
-  plot(circle_rotsumn, "Unit circle (rotsum)");
+  #ifdef HAS_CGAL
+  CircleMesh circle_mesh(Point(0.0, 0.0), 1.0, 0.2);
+  info("Plotting a CircleMesh");
+  plot(circle_mesh, "Circle (unstructured)");
+
+  std::vector<double> ellipse_dims(2);
+  ellipse_dims[0] = 3.0; ellipse_dims[1] = 1.0;
+  EllipseMesh ellipse_mesh(Point(0.0, 0.0), ellipse_dims, 0.2);
+  info("Plotting an EllipseMesh");
+  plot(ellipse_mesh, "Ellipse mesh (unstructured)");
+
+  SphereMesh sphere_mesh(Point(0.0, 0.0, 0.0), 1.0, 0.2);
+  info("Plotting a SphereMesh");
+  plot(sphere_mesh, "Sphere mesh (unstructured)");
+
+  std::vector<double> ellipsoid_dims(3);
+  ellipsoid_dims[0] = 3.0; ellipsoid_dims[1] = 1.0; ellipsoid_dims[2] = 2.0;
+  EllipsoidMesh ellipsoid_mesh(Point(0.0, 0.0, 0.0), ellipsoid_dims, 0.2);
+  info("Plotting an EllipsoidMesh");
+  plot(ellipsoid_mesh, "Ellipsoid mesh (unstructured)");
+  #endif
 
-  //UnitCircleMesh circle_sumn(20, "left", "sumn");
-  //info("Plotting a UnitCircle");
-  //plot(circle_sumn, "Unit circle (sumn)");
-
-  UnitCircleMesh circle_maxn(20, "right", "maxn");
-  info("Plotting a UnitCircleMesh");
-  plot(circle_maxn, "Unit circle (maxn)");
 
   UnitCubeMesh cube(10, 10, 10);
   info("Plotting a UnitCubeMesh");

File demo/documented/built-in_meshes/python/demo_built-in.py

 
 from dolfin import *
 
-
 mesh = UnitIntervalMesh(10)
 print "Plotting a UnitIntervalMesh"
 plot(mesh, title="Unit interval")
 print "Plotting a RectangleMesh"
 plot(mesh, title="Rectangle (right/left)")
 
-mesh = UnitCircleMesh(20, "right", "rotsumn")
-print "Plotting a UnitCircleMesh"
-plot(mesh, title="Unit circle (rotsum)")
+if has_cgal():
+    mesh = CircleMesh(Point(0.0, 0.0), 1.0, 0.2)
+    print "Plotting a CircleMesh"
+    plot(mesh, title="Circle (unstructured)")
+
+    mesh = EllipseMesh(Point(0.0, 0.0), [3.0, 1.0], 0.2)
+    print "Plotting an EllipseMesh"
+    plot(mesh, title="Ellipse mesh (unstructured)")
 
-#mesh = UnitCircleMesh(20, "left", "sumn")
-#print "Plotting a UnitCircle"
-#plot(mesh, title="Unit circle (sumn)")
+    mesh = SphereMesh(Point(0.0, 0.0, 0.0), 1.0, 0.2)
+    print "Plotting a SphereMesh"
+    plot(mesh, title="Sphere mesh (unstructured)")
 
-mesh = UnitCircleMesh(20, "right", "maxn")
-print "Plotting a UnitCircleMesh"
-plot(mesh, title="Unit circle (maxn)")
+    mesh = EllipsoidMesh(Point(0.0, 0.0, 0.0), [3.0, 1.0, 2.0], 0.2)
+    print "Plotting an EllipsoidMesh"
+    plot(mesh, title="Ellipsoid mesh (unstructured)")
 
 mesh = UnitCubeMesh(10, 10, 10)
 print "Plotting a UnitCubeMesh"

File demo/documented/built-in_meshes/python/documentation.rst

 ====================
 
 This demo is implemented in a single Python file,
-:download:`demo_built-in.py`, and demonstrates use of the built-in meshes in DOLFIN.
+:download:`demo_built-in.py`, and demonstrates use of the built-in
+meshes in DOLFIN.
 
 .. include:: ../common.txt
 
 
 .. code-block:: python
 
-	from dolfin import *
+   from dolfin import *
 
-The first mesh we make is a mesh over the unit interval :math:`(0,1)`. :py:class:`UnitIntervalMesh <dolfin.cpp.mesh.UnitIntervalMesh>` takes the number of intervals :math:`(n_x)` as input argument, and the total number of vertices is therefore :math:`(n_x+1)`.
+The first mesh we make is a mesh over the unit interval
+:math:`(0,1)`. :py:class:`UnitIntervalMesh
+<dolfin.cpp.mesh.UnitIntervalMesh>` takes the number of intervals
+:math:`(n_x)` as input argument, and the total number of vertices is
+therefore :math:`(n_x+1)`.
 
 .. code-block:: python
 
-	mesh = UnitIntervalMesh(10)
-	print "Plotting a UnitIntervalMesh"
-	plot(mesh, title="Unit interval")
+   mesh = UnitIntervalMesh(10)
+   print "Plotting a UnitIntervalMesh"
+   plot(mesh, title="Unit interval")
 
 This produces a mesh looking as follows:
 
 .. image:: unitintervalmesh.png
-	:scale: 75 %
+   :scale: 75 %
 
 We then make our first version of a mesh on the unit square
 :math:`[0,1] \times [0,1]`. We must give the number of cells in the
 horizontal and vertical directions as the first two arguments to
-:py:class:`UnitSquareMesh <dolfin.cpp.mesh.UnitSquareMesh>`. There is
-a third optional argument that indicates the direction of the
-diagonals. This can be set to "left", "right", "right/left",
-"left/right", or "crossed". We can also omit this argument and thereby
-use the default direction "right".
+:py:class:`UnitSquareMesh
+<dolfin.cpp.generation.UnitSquareMesh>`. There is a third optional
+argument that indicates the direction of the diagonals. This can be
+set to "left", "right", "right/left", "left/right", or "crossed". We
+can also omit this argument and thereby use the default direction
+"right".
 
 .. code-block:: python
 
-	mesh = UnitSquareMesh(10, 10)
-	print "Plotting a UnitSquareMesh"
-	plot(mesh, title="Unit square")
+   mesh = UnitSquareMesh(10, 10)
+   print "Plotting a UnitSquareMesh"
+   plot(mesh, title="Unit square")
 
 .. image:: unitsquaremesh.png
 	:scale: 75 %
 
 .. code-block:: python
 
-	mesh = UnitSquareMesh(10, 10, "left")
-	print "Plotting a UnitSquareMesh"
-	plot(mesh, title="Unit square (left)")
+   mesh = UnitSquareMesh(10, 10, "left")
+   print "Plotting a UnitSquareMesh"
+   plot(mesh, title="Unit square (left)")
 
-	mesh = UnitSquareMesh(10, 10, "crossed")
-	print "Plotting a UnitSquareMesh"
-	plot(mesh, title="Unit square (crossed)")
+   mesh = UnitSquareMesh(10, 10, "crossed")
+   print "Plotting a UnitSquareMesh"
+   plot(mesh, title="Unit square (crossed)")
 
-	mesh = UnitSquareMesh(10, 10, "right/left")
-	print "Plotting a UnitSquareMesh"
-	plot(mesh, title="Unit square (right/left)")
+   mesh = UnitSquareMesh(10, 10, "right/left")
+   print "Plotting a UnitSquareMesh"
+   plot(mesh, title="Unit square (right/left)")
 
 .. image:: unitsquaremesh_left.png
-	:scale: 65 %
+   :scale: 65 %
 
 .. image:: unitsquaremesh_crossed.png
-	:scale: 65 %
+   :scale: 65 %
 
 .. image:: unitsquaremesh_left_right.png
-	:scale: 65 %
+   :scale: 65 %
 
-The class :py:class:`RectangleMesh <dolfin.cpp.mesh.RectangleMesh>` (
-:math:`x_0,y_0,x_1,y_1,n_x,n_y`, direction) creates a mesh on a
+The class :py:class:`RectangleMesh
+<dolfin.cpp.generation.RectangleMesh>`
+(:math:`x_0,y_0,x_1,y_1,n_x,n_y`, direction) creates a mesh on a
 rectangle with one corner in :math:`(x_0,y_0)` and the opposite corner
 in :math:`(x_1,y_1)`. :math:`n_x` and :math:`n_y` specify the number
 of cells in the :math:`x`- and :math:`y`-directions, and as above the
 
 .. code-block:: python
 
-	mesh = RectangleMesh(0.0, 0.0, 10.0, 4.0, 10, 10)
-	print "Plotting a RectangleMesh"
-	plot(mesh, title="Rectangle")
+   mesh = RectangleMesh(0.0, 0.0, 10.0, 4.0, 10, 10)
+   print "Plotting a RectangleMesh"
+   plot(mesh, title="Rectangle")
 
-	mesh = RectangleMesh(-3.0, 2.0, 7.0, 6.0, 10, 10, "right/left")
-	print "Plotting a RectangleMesh"
-	plot(mesh, title="Rectangle (right/left)")
+   mesh = RectangleMesh(-3.0, 2.0, 7.0, 6.0, 10, 10, "right/left")
+   print "Plotting a RectangleMesh"
+   plot(mesh, title="Rectangle (right/left)")
 
 .. image:: rectanglemesh.png
 	:scale: 75 %
 .. image:: rectanglemesh_left_right.png
 	:scale: 75 %
 
+Unstructured ellipsoid and ellipse meshes can be created if DOLFIN is
+configured with CGAL.  Using :py:class:`CircleMesh
+<dolfin.cpp.generation.CircleMesh>` For a circle centered at (0, 0)
+with radius 1 and cell size 0.2:
 
-To create a mesh on the unit circle we use :py:class:`UnitCircleMesh
-<dolfin.cpp.mesh.UnitCircleMesh>`. The first argument specifies the
-resolution of the mesh by setting the number of nodes in the
-semi-circumference. The second argument decides the direction of the
-diagonals ("left", "right", "left/right", or "crossed"). This is
-optional and has the default value "crossed". The third and final
-argument is also an optional argument, and it specifies the
-transformation used to transform the square :math:`(-1,1)\times
-(-1,1)` into the unit circle. There are three possible
-transformations("rotsumn", "maxn", "sumn"). The default one
-("rotsumn") uses a rotational matrix and is defines as follows:
-
-.. math::
-
-	\text{rotsumn}:&= \frac{(x_r,y_r)}{\sqrt{x_r^2+y_r^2}}\\
-	(x_r,y_r)&=\frac{\sqrt{2}}{2} \begin{bmatrix}
-				\cos(\frac{\pi}{4})&	\sin(\frac{\pi}{4})\\
-				-\sin(\frac{\pi}{4})&   \cos(\frac{\pi}{4})
-				\end{bmatrix} \begin{bmatrix}
-						x \\ y
-							\end{bmatrix}
+.. code-block:: python
 
+    mesh = CircleMesh(Point(0.0, 0.0), 1.0, 0.2)
+    print "Plotting a CircleMesh"
+    plot(mesh, title="Circle (unstructured)")
 
+Using :py:class:`EllipseMesh <dolfin.cpp.generation.EllipseMesh>` for
+an ellipse centered at (0, 0) with 'radii' of 3 and 1 in the
+:math:`x`- and :math:`y` directions, respectively, and cell size 0.2:
 
 .. code-block:: python
 
-	mesh = UnitCircleMesh(20, "right", "rotsumn")
-	print "Plotting a UnitCircleMesh"
-	plot(mesh, title="Unit circle (rotsum)")
+   mesh = EllipseMesh(Point(0.0, 0.0), [3.0, 1.0], 0.2)
+   print "Plotting an EllipseMesh"
+   plot(mesh, title="Ellipse mesh (unstructured)")
 
-.. image:: unitcirclemesh_rotsum.png
-	:scale: 75 %
+Using :py:class:`SphereMesh <dolfin.cpp.generation.SphereMesh>` for a
+sphere centered at (0, 0, 0) with radius 1 and cell size 0.2:
 
+.. code-block:: python
 
-The second transformation ("maxn") produced the following mesh:
+   mesh = SphereMesh(Point(0.0, 0.0, 0.0), 1.0, 0.2)
+   print "Plotting a SphereMesh"
+   plot(mesh, title="Sphere mesh (unstructured)")
 
-.. code-block:: python
+Using :py:class:`EllipsoidMesh <dolfin.cpp.generation.EllipsoidMesh>`
+For an ellipsoid centered at (0, 0, 0.0), with 'radii' of 3, 1 and 2
+in the :math:`x`-, :math:`y` and :math`z`-directions, respectively,
+and cell size 0.2:
 
-	mesh = UnitCircleMesh(20, "right", "maxn")
-	print "Plotting a UnitCircleMesh"
-	plot(mesh, title="Unit circle (maxn)")
+.. code-block:: python
 
-.. image:: unitcirclemesh_maxn.png
-	:scale: 75 %
+   mesh = EllipsoidMesh(Point(0.0, 0.0, 0.0), [3.0, 1.0, 2.0], 0.2)
+   print "Plotting an EllipsoidMesh"
+   plot(mesh, title="Ellipsoid mesh (unstructured)")
 
-To make a mesh of the 3D unit cube :math:`[0,1]\times [0,1]\times
+To make a mesh of the 3D unit cube :math:`[0,1] \times [0,1] \times
 [0,1]`, we use :py:class:`UnitCubeMesh
-<dolfin.cpp.mesh.UnitCubeMesh>`. :py:class:`UnitCubeMesh
-<dolfin.cpp.mesh.UnitCubeMesh>` takes the number of cells in the
+<dolfin.cpp.generation.UnitCubeMesh>`. :py:class:`UnitCubeMesh
+<dolfin.cpp.generation.UnitCubeMesh>` takes the number of cells in the
 :math:`x`-, :math:`y`- and :math:`z`-direction as the only three
 arguments.
 
-
 .. code-block:: python
 
-	mesh = UnitCubeMesh(10, 10, 10)
-	print "Plotting a UnitCubeMesh"
-	plot(mesh, title="Unit cube")
+   mesh = UnitCubeMesh(10, 10, 10)
+   print "Plotting a UnitCubeMesh"
+   plot(mesh, title="Unit cube")
 
 .. image:: unitcubemesh.png
-	:scale: 75 %
-
+   :scale: 75 %
 
 Finally we will demonstrate a mesh on a rectangular prism in
-3D. :py:class:`BoxMesh <dolfin.cpp.mesh.BoxMesh>` (
-:math:`x_0,y_0,z_0,x_1,y_1,z_1,x_n,y_n,z_n`) takes the coordinates of
+3D. :py:class:`BoxMesh <dolfin.cpp.generation.BoxMesh>`
+(:math:`x_0,y_0,z_0,x_1,y_1,z_1,x_n,y_n,z_n`) takes the coordinates of
 the first corner(:math:`x_0,y_0,z_0`) as the three first arguments,
 the coordinates of the opposite corner (:math:`x_1,y_1,z_1`) as the
 next three arguments, while the last three arguments specify the
 
 .. code-block:: python
 
-	mesh = BoxMesh(0.0, 0.0, 0.0, 10.0, 4.0, 2.0, 10, 10, 10)
-	print "Plotting a BoxMesh"
-	plot(mesh, title="Box")
+   mesh = BoxMesh(0.0, 0.0, 0.0, 10.0, 4.0, 2.0, 10, 10, 10)
+   print "Plotting a BoxMesh"
+   plot(mesh, title="Box")
 
 .. image:: boxmesh.png
-	:scale: 75 %
+   :scale: 75 %
 
-By calling :py:meth:`interactive <dolfin.cpp.io.VTKPlotter.interactive>` we are allowed to resize, move and rotate the plots.
+By calling :py:meth:`interactive
+<dolfin.cpp.io.VTKPlotter.interactive>` we are allowed to resize, move
+and rotate the plots.
 
 .. code-block:: python
 
-	interactive()
+   interactive()
 
 
 Complete code
 
 .. literalinclude:: demo_built-in.py
    :start-after: # Begin demo
-

File demo/documented/csg-2D/cpp/main.cpp

 #endif
 
   // Define 2D geometry
-  Rectangle r(0.5, 0.5, 1.5, 1.5);
-  Circle c(1, 1, 1);
-  boost::shared_ptr<CSGGeometry> g2d = c - r;
+  // Rectangle r(0.5, 0.5, 1.5, 1.5);
+  // Circle c(1, 1, 1);
+  // boost::shared_ptr<CSGGeometry> g2d = c - r;
+
+  // Define 2D geometry
+  Rectangle r1(0., 0., 5., 5.);
+  Rectangle r2 (2., 1.25, 3., 1.75);
+  Circle c1(1, 4, .25);
+  Circle c2(4, 4, .25);
+  boost::shared_ptr<CSGGeometry> domain =  r1 - r2 - c1 - c2;
+
+  Rectangle s1(1., 1., 4., 3.);
+  domain->set_subdomain(1, s1);
+
+  Rectangle s2(2., 2., 3., 4.);
+  domain->set_subdomain(2, s2);
+
 
   // Test printing
   info("\nCompact output of 2D geometry:");
-  info(*g2d);
+  info(*domain);
   info("");
   info("\nVerbose output of 2D geometry:");
-  info(*g2d, true);
+  info(*domain, true);
 
   // Plot geometry
-  plot(g2d, "2D Geometry (boundary)");
+  plot(domain, "2D Geometry (boundary)");
 
   // Generate and plot mesh
-  Mesh mesh2d(g2d, 100);
+  boost::shared_ptr<Mesh>  mesh2d(new Mesh(domain, 45));
   plot(mesh2d, "2D mesh");
 
+  // Convert mesh domains to mesh function for plotting
+  MeshFunction<std::size_t> mf(mesh2d, 2, mesh2d->domains());
+  plot(mf, "Subdomains");
+
+
   interactive();
   return 0;
 }

File demo/documented/csg-2D/python/demo_csg_2D.py

 
 
 # Define 2D geometry
-r = Rectangle(0.5, 0.5, 1.5, 1.5);
-c = Circle (1, 1, 1);
-g2d = c - r;
+domain = Rectangle(0., 0., 5., 5.) - Rectangle(2., 1.25, 3., 1.75) - Circle(1, 4, .25) - Circle(4, 4, .25)
+domain.set_subdomain(1, Rectangle(1., 1., 4., 3.))
+domain.set_subdomain(2, Rectangle(2., 2., 3., 4.))
+
 
 # Test printing
-info("\nCompact output of 2D geometry:");
-info(g2d);
-info("");
-info("\nVerbose output of 2D geometry:");
-info(g2d, True);
+info("\nCompact output of 2D geometry:")
+info(domain)
+info("")
+info("\nVerbose output of 2D geometry:")
+info(domain, True)
 
 # Plot geometry
-plot(g2d, "2D Geometry (boundary)");
+plot(domain, "2D Geometry (boundary)")
 
 # Generate and plot mesh
-mesh2d = Mesh(g2d, 10);
-plot(mesh2d, "2D mesh");
+mesh2d = Mesh(domain, 45)
+plot(mesh2d, "2D mesh")
+
+# Convert subdomains to mesh function for plotting
+mf = MeshFunction("size_t", mesh2d, 2, mesh2d.domains())
+plot(mf, "Subdomains")
+
 
-interactive();
+interactive()

File demo/documented/neumann-poisson/common.txt

 .. math::
 
 	- \nabla^{2} u &= f \quad {\rm in} \ \Omega, \\
-    \nabla u \cdot n &= g \quad {\rm on} \ \partial \Omega.
+      \nabla u \cdot n &= g \quad {\rm on} \ \partial \Omega.
 
 Here, :math:`f` and :math:`g` are input data and :math:`n` denotes the
 outward directed boundary normal. Since only Neumann conditions are
 
 .. math::
 
-	\int u \, {\rm d} x = 0
+	\int_{\Omega} u \, {\rm d} x = 0.
 
 This can be accomplished by introducing the constant :math:`c` as an
 additional unknown (to be sought in :math:`\mathbb{R}`) and the above
-constraint.
+constraint expressed via a Lagrange multiplier.
+
+We further note that a necessary condition for the existence of a
+solution to the Neumann problem is that the right-hand side :math:`f`
+satisfies
+
+.. math::
+
+	\int_{\Omega} f \, {\rm d} x = - \int_{\partial\Omega} g \, {\rm d} s.
+
+This can be seen by multiplying by :math:`1` and integrating by
+parts:
+
+.. math::
+
+	\int_{\Omega} f \, {\rm d} x = - \int_{\Omega} 1 \cdot \nabla^{2} u \, {\rm d} x
+                                     = - \int_{\partial\Omega} 1 \cdot \partial_n u \, {\rm d} s
+                                       + \int_{\Omega} \nabla 1 \cdot \nabla u \, {\rm d} x
+                                     = - \int_{\partial\Omega} g \, {\rm d} s.
+
+This condition is not satisfied by the specific right-hand side chosen
+for this test problem, which means that the partial differential
+equation is not well-posed. However, the variational problem expressed
+below is well-posed as the Lagrange multiplier introduced to satisfy
+the condition :math:`\int_{\Omega} u \, {\rm d} x = 0` *effectively
+redefines the right-hand side such that it safisfies the necessary
+condition* :math:`\int_{\Omega} f \, {\rm d} x = -
+\int_{\partial\Omega} g \, {\rm d} s`.
 
 Our variational form reads: Find :math:`(u, c) \in V \times R` such
 that
 						+ \int_{\Omega} cv \, {\rm d} x
 						+ \int_{\Omega} ud \, {\rm d} x, \\
 	L(v)    &= \int_{\Omega} f v \, {\rm d} x
-    	     	+ \int_{\Gamma_{N}} g v \, {\rm d} s.
+    	     	+ \int_{\partial\Omega} g v \, {\rm d} s.
 
 :math:`V` is a suitable function space containing :math:`u` and
 :math:`v`, and :math:`R` is the space of real numbers.
 The expression :math:`a(\cdot, \cdot)` is the bilinear form and
 :math:`L(\cdot)` is the linear form.
 
+Note that the above variational problem may alternatively be expressed
+in terms of the modified (and consistent) right-hand side
+:math:`\tilde{f} = f - c`.
+
 In this demo we shall consider the following definitions of the domain
 and input functions:
 

File demo/documented/periodic/python/demo_periodic.py

     def eval(self, values, x):
         dx = x[0] - 0.5
         dy = x[1] - 0.5
-        values[0] = x[0]*sin(5.0*DOLFIN_PI*x[1]) + 1.0*exp(-(dx*dx + dy*dy)/0.02)
+        values[0] = x[0]*sin(5.0*DOLFIN_PI*x[1]) \
+                    + 1.0*exp(-(dx*dx + dy*dy)/0.02)
 
 # Sub domain for Dirichlet boundary condition
 class DirichletBoundary(SubDomain):
     def inside(self, x, on_boundary):
-        return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) and on_boundary)
+        return bool((x[1] < DOLFIN_EPS or x[1] > (1.0 - DOLFIN_EPS)) \
+                    and on_boundary)
 
 # Sub domain for Periodic boundary condition
 class PeriodicBoundary(SubDomain):
         y[0] = x[0] - 1.0
         y[1] = x[1]
 
-# Create periodic boundary condition
-pbc = PeriodicBoundary()
-
 # Create mesh and finite element
 mesh = UnitSquareMesh(32, 32)
-V = FunctionSpace(mesh, "CG", 1, constrained_domain=pbc)
-
+V = FunctionSpace(mesh, "CG", 1, constrained_domain=PeriodicBoundary())
 
 # Create Dirichlet boundary condition
 u0 = Constant(0.0)
 dbc = DirichletBoundary()
 bc0 = DirichletBC(V, u0, dbc)
 
-#bc1 = PeriodicBC(V, pbc)
-
 # Collect boundary conditions
 bcs = [bc0]
 

File demo/undocumented/built-in/cpp/main.cpp

 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2009-09-29
-// Last changed: 2012-12-12
+// Last changed: 2013-11-11
 //
 // This demo illustrates the built-in mesh types.
 
   info("Plotting a RectangleMesh");
   plot(rectangle_right_left, "Rectangle (right/left)");
 
+#ifdef HAS_CGAL
   UnitCircleMesh circle_rotsumn(20, "right", "rotsumn");
   info("Plotting a UnitCircleMesh");
   plot(circle_rotsumn, "Unit circle (rotsum)");
   UnitCircleMesh circle_maxn(20, "right", "maxn");
   info("Plotting a UnitCircleMesh");
   plot(circle_maxn, "Unit circle (maxn)");
+#endif
 
   UnitCubeMesh cube(10, 10, 10);
   info("Plotting a UnitCubeMesh");

File demo/undocumented/built-in/python/demo_built-in.py

 print "Plotting a RectangleMesh"
 plot(mesh, title="Rectangle (right/left)")
 
-mesh = UnitCircleMesh(20, "right", "rotsumn")
-print "Plotting a UnitCircleMesh"
-plot(mesh, title="Unit circle (rotsum)")
+if has_cgal():
+    mesh = UnitCircleMesh(20, "right", "rotsumn")
+    print "Plotting a UnitCircleMesh"
+    plot(mesh, title="Unit circle (rotsum)")
 
-#mesh = UnitCircleMesh(20, "left", "sumn")
-#print "Plotting a UnitCircle"
-#plot(mesh, title="Unit circle (sumn)")
+    #mesh = UnitCircleMesh(20, "left", "sumn")
+    #print "Plotting a UnitCircle"
+    #plot(mesh, title="Unit circle (sumn)")
 
-mesh = UnitCircleMesh(20, "right", "maxn")
-print "Plotting a UnitCircleMesh"
-plot(mesh, title="Unit circle (maxn)")
+    mesh = UnitCircleMesh(20, "right", "maxn")
+    print "Plotting a UnitCircleMesh"
+    plot(mesh, title="Unit circle (maxn)")
 
 mesh = UnitCubeMesh(10, 10, 10)
 print "Plotting a UnitCubeMesh"

File demo/undocumented/ccfem-poisson/cpp/main.cpp

 // along with DOLFIN. If not, see <http://www.gnu.org/licenses/>.
 //
 // First added:  2013-06-26
-// Last changed: 2013-09-25
+// Last changed: 2013-10-27
 //
 // This demo program solves Poisson's equation using a Cut and
 // Composite Finite Element Method (CCFEM) on a domain defined by
 
 int main()
 {
+  return 0;
+
+
   info("THIS DEMO IS WORK IN PROGRESS!");
 
   // Increase log level

File demo/undocumented/collision-detection/python/demo_collision-detection.py

 
 from dolfin import *
 
+# Check that DOLFIN is configured with CGAL
+if not has_cgal():
+    print "DOLFIN must be compiled with CGAL to run this demo."
+    exit(0)
+
 # Some parameters
 L = 10.0
 h = 0.1
 
 # Create meshes: a box and two circles
 mesh_A = RectangleMesh(0, 0, L, L, M, M)
-mesh_B = UnitCircleMesh(N)
-mesh_C = UnitCircleMesh(N)
+mesh_B = CircleMesh(Point(0.0, 0.0), 1.0, 1.0/N)
+mesh_C = CircleMesh(Point(0.0, 0.0), 1.0, 1.0/N)
 
 # Displace circles to initial positions
 mesh_B.translate(Point(x_B, y_B))

File demo/undocumented/contact-vi-snes/circle_yplane.geo

+// Gmsh input file for unit radius circle with mesh symmetry line on y-axis
+cl__1 = 0.05;
+Point(1) = {0, 1, 0, cl__1};
+Point(2) = {1, 0, 0, cl__1};
+Point(3) = {0, -1, 0, cl__1};
+Point(4) = {-1, 0, 0, cl__1};
+Point(6) = {0, 0, 0, cl__1};
+Circle(1) = {1, 6, 4};
+Circle(2) = {4, 6, 3};
+Circle(3) = {3, 6, 2};
+Circle(4) = {2, 6, 1};
+Line Loop(7) = {1, 2, 3, 4};
+Plane Surface(7) = {7};
+Line(8) = {1, 3};
+Line{8} In Surface {7};

File demo/undocumented/contact-vi-snes/cpp/main.cpp

 
 using namespace dolfin;
 
+// Sub domain for symmetry condition
+class SymmetryLine : public SubDomain
+{
+  bool inside(const Array<double>& x, bool on_boundary) const
+  { return (std::abs(x[0]) < DOLFIN_EPS); }
+};
+
+// Lower bound for displacement
+class LowerBound : public Expression
+{
+public:
+  LowerBound() : Expression(2) {}
+  void eval(Array<double>& values, const Array<double>& x) const
+  {
+    const double xmin = -1.0 - DOLFIN_EPS;
+    const double ymin = -1.0;
+    values[0] = xmin - x[0];
+    values[1] = ymin - x[1];
+  }
+};
+
+// Upper bound for displacement
+class UpperBound : public Expression
+{
+public:
+  UpperBound() : Expression(2) {}
+  void eval(Array<double>& values, const Array<double>& x) const
+  {
+    const double xmax = 1.0 + DOLFIN_EPS;
+    const double ymax = 2.0;
+    values[0] = xmax - x[0];
+    values[1] = ymax - x[1];
+  }
+};
+
 int main()
 {
 #ifdef HAS_PETSC
-    // Sub domain for symmetry condition
-    class SymmetryLine : public SubDomain
-    {
-        bool inside(const Array<double>& x, bool on_boundary) const
-        {
-        return (std::abs(x[0]) < DOLFIN_EPS);
-        }
-    };
-    // Lower bound for displacement
-    class LowerBound : public Expression
-    {
-    public:
-
-      LowerBound() : Expression(2) {}
-
-      void eval(Array<double>& values, const Array<double>& x) const
-      {
-        double xmin = -1.-DOLFIN_EPS;
-        double ymin = -1.;
-        values[0] = xmin-x[0];
-        values[1] = ymin-x[1];
-      }
-
-    };
-
-    // Upper bound for displacement
-    class UpperBound : public Expression
-    {
-    public:
-
-      UpperBound() : Expression(2) {}
-
-      void eval(Array<double>& values, const Array<double>& x) const
-      {
-        double xmax = 1.+DOLFIN_EPS;
-        double ymax = 2.;
-        values[0] = xmax-x[0];
-        values[1] = ymax-x[1];
-      }
-
-    };
 
   // Read mesh and create function space
-#ifdef HAS_CGAL
-  Circle circle(0, 0, 1);
-  Mesh   mesh(circle,30);
-#else
-  UnitCircleMesh mesh(30);
-#endif
+  Mesh mesh("../circle_yplane.xml.gz");
+
+  // Create function space
   HyperElasticity::FunctionSpace V(mesh);
 
   // Create Dirichlet boundary conditions
   const double E  = 10.0;
   const double nu = 0.3;
   Constant mu(E/(2*(1 + nu)));
-  Constant lambda(E*nu/((1 + nu)*(1 - 2*nu)));
+  Constant lambda(E*nu/((1.0 + nu)*(1.0 - 2.0*nu)));
 
   // Create (linear) form defining