--- Begin Message ---
------------------------------------------------------------
revno: 4333
committer: Garth N. Wells <gnw20@xxxxxxxxx>
branch nick: dolfin-all
timestamp: Sun 2009-12-06 12:00:23 +0000
message:
Add outline of a new Array class.
added:
dolfin/common/Array.cpp
dolfin/common/Array.h
modified:
demo/mesh/intersection/3D/python/demo.py
dolfin/common/dolfin_common.h
dolfin/swig/docstrings.i
dolfin/swig/kernel_modules.i
--
lp:dolfin
https://code.launchpad.net/~dolfin-core/dolfin/main
Your team DOLFIN Core Team is subscribed to branch lp:dolfin.
To unsubscribe from this branch go to https://code.launchpad.net/~dolfin-core/dolfin/main/+edit-subscription.
=== modified file 'demo/mesh/intersection/3D/python/demo.py'
--- demo/mesh/intersection/3D/python/demo.py 2009-12-05 19:01:50 +0000
+++ demo/mesh/intersection/3D/python/demo.py 2009-12-06 12:00:23 +0000
@@ -38,9 +38,8 @@
counter = 0
while t < 1.4 :
+ # Compute intersection with boundary of square
boundary = BoundaryMesh(sphere)
- # Compute intersection with boundary of square
-# cells = cube.all_intersected_entities(sphere)
cells = cube.all_intersected_entities(boundary)
# Mark intersected values
=== added file 'dolfin/common/Array.cpp'
--- dolfin/common/Array.cpp 1970-01-01 00:00:00 +0000
+++ dolfin/common/Array.cpp 2009-12-06 12:00:23 +0000
@@ -0,0 +1,65 @@
+// Copyright (C) 2009 Garth N. Wells.
+// Licensed under the GNU LGPL Version 2.1.
+//
+// First added: 2009-12-06
+// Last changed:
+
+#include "Array.h"
+
+using namespace dolfin;
+
+//-----------------------------------------------------------------------------
+Array::Array(uint N): _size(N), x(new double(N))
+{
+ // Do nothing
+}
+//-----------------------------------------------------------------------------
+Array::Array(const Array& x)
+{
+ error("Not implemented");
+}
+//-----------------------------------------------------------------------------
+Array::Array(uint N, boost::shared_array<double> x) : _size(N), x(x)
+{
+ // Do nothing
+}
+//-----------------------------------------------------------------------------
+Array::~Array()
+{
+ // Do nothing
+}
+//-----------------------------------------------------------------------------
+void Array::resize(uint N)
+{
+ error("Not implemented");
+}
+//-----------------------------------------------------------------------------
+dolfin::uint Array::size() const
+{
+ return _size;
+}
+//-----------------------------------------------------------------------------
+void Array::zero()
+{
+ error("No implemented");
+}
+//-----------------------------------------------------------------------------
+double Array::min() const
+{
+ error("No implemented");
+ return 0.0;
+}
+//-----------------------------------------------------------------------------
+double Array::max() const
+{
+ error("No implemented");
+ return 0.0;
+}
+//-----------------------------------------------------------------------------
+std::string Array::str(bool verbose) const
+{
+ error("No implemented");
+ return "";
+}
+//-----------------------------------------------------------------------------
+
=== added file 'dolfin/common/Array.h'
--- dolfin/common/Array.h 1970-01-01 00:00:00 +0000
+++ dolfin/common/Array.h 2009-12-06 12:00:23 +0000
@@ -0,0 +1,87 @@
+// Copyright (C) 2009 Garth N. Wells.
+// Licensed under the GNU LGPL Version 2.1.
+//
+// First added: 2009-12-06
+// Last changed:
+
+#ifndef __ARRAY_H
+#define __ARRAY_H
+
+#include <boost/shared_array.hpp>
+
+#include <dolfin/common/types.h>
+#include <dolfin/log/dolfin_log.h>
+
+namespace dolfin
+{
+
+ /// This class provides a simple vector-type class for doubles. A purpose of
+ /// this class is to enable the simple and safe exchange of data between C++
+ /// and Python.
+
+ class Array
+ {
+ public:
+
+ /// Create array of size N
+ explicit Array(uint N);
+
+ /// Copy constructor
+ explicit Array(const Array& x);
+
+ /// Construct array from a shared pointer
+ Array(uint N, boost::shared_array<double> x);
+
+ /// Destructor
+ ~Array();
+
+ /// Assignment operator
+ const Array& operator= (const Array& x);
+
+ /// Return informal string representation (pretty-print)
+ std::string str(bool verbose) const;
+
+ /// Resize array to size N. If size changes, contents will be destroyed.
+ void resize(uint N);
+
+ /// Return size of array
+ uint size() const;
+
+ /// Zero array
+ void zero();
+
+ /// Return minimum value of array
+ double min() const;
+
+ /// Return maximum value of array
+ double max() const;
+
+ /// Access value of given entry (const version)
+ double operator[] (uint i) const
+ { assert(i < _size); return x[i]; };
+
+ /// Access value of given entry (non-const version)
+ double& operator[] (uint i)
+ { assert(i < _size); return x[i]; };
+
+ /// Return pointer to data (const version)
+ const boost::shared_array<double> data() const
+ { return x; }
+
+ /// Return pointer to data (non-const version)
+ boost::shared_array<double> data()
+ { return x; }
+
+ private:
+
+ // Length of array
+ dolfin::uint _size;
+
+ // Array data
+ boost::shared_array<double> x;
+
+ };
+
+}
+
+#endif
=== modified file 'dolfin/common/dolfin_common.h'
--- dolfin/common/dolfin_common.h 2009-10-07 11:18:10 +0000
+++ dolfin/common/dolfin_common.h 2009-12-06 12:00:23 +0000
@@ -7,6 +7,7 @@
#include <dolfin/common/real.h>
#include <dolfin/common/constants.h>
#include <dolfin/common/timing.h>
+#include <dolfin/common/Array.h>
#include <dolfin/common/Timer.h>
#include <dolfin/common/Variable.h>
=== modified file 'dolfin/swig/docstrings.i'
--- dolfin/swig/docstrings.i 2009-11-16 15:13:08 +0000
+++ dolfin/swig/docstrings.i 2009-12-06 12:00:23 +0000
@@ -25,6 +25,65 @@
C++ includes: ALE.h ";
+// File: classdolfin_1_1Array.xml
+%feature("docstring") dolfin::Array "
+
+This class provides a simple vector-type class for doubles. A purpose
+of this class is to enable the simple and safe exchange of data
+between C++ and Python.
+
+C++ includes: Array.h ";
+
+%feature("docstring") dolfin::Array::Array "
+
+Create array of size N. ";
+
+%feature("docstring") dolfin::Array::Array "
+
+Copy constructor. ";
+
+%feature("docstring") dolfin::Array::Array "
+
+Construct array from a shared pointer. ";
+
+%feature("docstring") dolfin::Array::~Array "
+
+Destructor. ";
+
+%feature("docstring") dolfin::Array::str "
+
+Return informal string representation (pretty-print). ";
+
+%feature("docstring") dolfin::Array::resize "
+
+Resize array to size N. If size changes, contents will be destroyed.
+";
+
+%feature("docstring") dolfin::Array::size "
+
+Return size of array. ";
+
+%feature("docstring") dolfin::Array::zero "
+
+Zero array. ";
+
+%feature("docstring") dolfin::Array::min "
+
+Return minimum value of array. ";
+
+%feature("docstring") dolfin::Array::max "
+
+Return maximum value of array. ";
+
+%feature("docstring") dolfin::Array::data "
+
+Return pointer to data (const version). ";
+
+%feature("docstring") dolfin::Array::data "
+
+Return pointer to data (non-const version). ";
+
+
// File: classdolfin_1_1Assembler.xml
%feature("docstring") dolfin::Assembler "
@@ -267,6 +326,8 @@
Constructor. ";
+%feature("docstring") dolfin::Cell::Cell "";
+
%feature("docstring") dolfin::Cell::~Cell "
Destructor. ";
@@ -336,6 +397,8 @@
%feature("docstring") dolfin::CellIterator::CellIterator "";
+%feature("docstring") dolfin::CellIterator::CellIterator "";
+
// File: classdolfin_1_1CellSize.xml
%feature("docstring") dolfin::CellSize "
@@ -1286,9 +1349,7 @@
%feature("docstring") dolfin::Expression::value_rank "
-Return geometric dimension.
-
-Return value rank ";
+Return value rank. ";
%feature("docstring") dolfin::Expression::value_dimension "
@@ -1310,10 +1371,6 @@
Evaluate expression, must be overloaded by user (simple version). ";
-%feature("docstring") dolfin::Expression::eval "
-
-Evaluate expression, must be overloaded by user (simple version). ";
-
// File: classdolfin_1_1Face.xml
%feature("docstring") dolfin::Face "
@@ -2549,6 +2606,84 @@
Compute overlap with mesh (test version). ";
+// File: classdolfin_1_1IntersectionOperator.xml
+%feature("docstring") dolfin::IntersectionOperator "";
+
+%feature("docstring")
+dolfin::IntersectionOperator::IntersectionOperator "
+
+Create intersection detector for the mesh mesh.
+
+Parameters:
+-----------
+
+kernel_type: The CGAL geometric kernel is used to compute predicates,
+intersections and such. Depending on this choice the kernel
+(kernel_type = \"ExcactPredicates\") can compute predicates excactly
+(without roundoff error) or only approximately (default, kernel_type =
+\"SimpleCartesian\"). ";
+
+%feature("docstring")
+dolfin::IntersectionOperator::IntersectionOperator "";
+
+%feature("docstring")
+dolfin::IntersectionOperator::~IntersectionOperator "
+
+Destructor. Needed be explicit written, otherwise default inline here,
+with prohibits pImpl with scoped_ptr. ";
+
+%feature("docstring")
+dolfin::IntersectionOperator::all_intersected_entities "
+
+Compute all id of all cells which are intersects by a point.
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring")
+dolfin::IntersectionOperator::all_intersected_entities "
+
+Compute all id of all cells which are intersects any point in points.
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring")
+dolfin::IntersectionOperator::all_intersected_entities "
+
+Compute all id of all cells which are intersects by the given mesh
+another_mesh;
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring")
+dolfin::IntersectionOperator::any_intersected_entity "
+
+Computes only the first id of the entity, which contains the point.
+Returns -1 if no cell is intersected. ";
+
+%feature("docstring") dolfin::IntersectionOperator::reset_kernel "
+
+Rebuilds the underlying search structure from scratch and uses the
+kernel kernel_type underlying CGAL Geometry kernel. ";
+
+%feature("docstring") dolfin::IntersectionOperator::clear "
+
+clears search structure. Should be used if the mesh has changed ";
+
+%feature("docstring") dolfin::IntersectionOperator::mesh "";
+
+
// File: classdolfin_1_1Interval.xml
%feature("docstring") dolfin::Interval "
@@ -3105,6 +3240,14 @@
Return mesh geometry (const version). ";
+%feature("docstring") dolfin::Mesh::intersection_operator "
+
+Return intersectionoperator (const version);. ";
+
+%feature("docstring") dolfin::Mesh::intersection_operator "
+
+Return intersectionoperator (non-const version);. ";
+
%feature("docstring") dolfin::Mesh::data "
Return mesh data (non-const version). ";
@@ -3180,25 +3323,41 @@
Smooth mesh using Lagrangian mesh smoothing. ";
-%feature("docstring") dolfin::Mesh::intersection "
-
-Compute cells intersecting point. ";
-
-%feature("docstring") dolfin::Mesh::intersection "
-
-Compute cells overlapping line defined by points. ";
-
-%feature("docstring") dolfin::Mesh::intersection "
-
-Compute cells overlapping cell. ";
-
-%feature("docstring") dolfin::Mesh::intersection "
-
-Compute intersection with curve defined by points. ";
-
-%feature("docstring") dolfin::Mesh::intersection "
-
-Compute intersection with mesh. ";
+%feature("docstring") dolfin::Mesh::all_intersected_entities "
+
+Compute all id of all cells which are intersects by a point.
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring") dolfin::Mesh::all_intersected_entities "
+
+Compute all id of all cells which are intersects any point in points.
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring") dolfin::Mesh::all_intersected_entities "
+
+Compute all id of all cells which are intersects by the given mesh
+another_mesh;
+
+Parameters:
+-----------
+
+ids_result: The ids of the intersected entities are saved in a set
+for efficienty reasons, to avoid to sort out duplicates later on. ";
+
+%feature("docstring") dolfin::Mesh::any_intersected_entity "
+
+Computes only the first id of the entity, which contains the point.
+Returns -1 if no cell is intersected. ";
%feature("docstring") dolfin::Mesh::hmin "
@@ -3500,6 +3659,10 @@
%feature("docstring") dolfin::MeshEntity::MeshEntity "
+Default Constructor. ";
+
+%feature("docstring") dolfin::MeshEntity::MeshEntity "
+
Constructor. ";
%feature("docstring") dolfin::MeshEntity::~MeshEntity "
@@ -3567,6 +3730,11 @@
%feature("docstring") dolfin::MeshEntityIterator::MeshEntityIterator
"
+Default constructor. ";
+
+%feature("docstring") dolfin::MeshEntityIterator::MeshEntityIterator
+"
+
Create iterator for mesh entities over given topological dimension. ";
%feature("docstring") dolfin::MeshEntityIterator::MeshEntityIterator
@@ -3580,6 +3748,11 @@
Destructor. ";
+%feature("docstring") dolfin::MeshEntityIterator::MeshEntityIterator
+"
+
+Copy Constructor. ";
+
%feature("docstring") dolfin::MeshEntityIterator::pos "
Return current position. ";
@@ -3588,6 +3761,13 @@
Check if iterator has reached the end. ";
+%feature("docstring") dolfin::MeshEntityIterator::end_iterator "
+
+Provide a safeguard iterator pointing beyond the end of an iteration
+process, either iterating over the mesh /or incident entities. Added
+to be bit more like STL iteratoren, since many algorithms rely on a
+kind of beyond iterator. ";
+
// File: classdolfin_1_1MeshFunction.xml
%feature("docstring") dolfin::MeshFunction "
@@ -6642,6 +6822,10 @@
Report that functionality has not (yet) been implemented to work in
parallel. ";
+%feature("docstring") dolfin::check_equal "
+
+Check value and print an informative error message if invalid. ";
+
%feature("docstring") dolfin::__debug "";
%feature("docstring") dolfin::solve "
@@ -6735,6 +6919,9 @@
// File: ALEType_8h.xml
+// File: Array_8h.xml
+
+
// File: constants_8h.xml
@@ -7032,6 +7219,9 @@
// File: IntersectionDetector_8h.xml
+// File: IntersectionOperator_8h.xml
+
+
// File: Interval_8h.xml
@@ -7065,12 +7255,18 @@
// File: MeshPartitioning_8h.xml
+// File: MeshPrimitive_8h.xml
+
+
// File: MeshTopology_8h.xml
// File: Point_8h.xml
+// File: Primitive__Traits_8h.xml
+
+
// File: Rectangle_8h.xml
=== modified file 'dolfin/swig/kernel_modules.i'
--- dolfin/swig/kernel_modules.i 2009-11-27 01:41:12 +0000
+++ dolfin/swig/kernel_modules.i 2009-12-06 12:00:23 +0000
@@ -6,6 +6,7 @@
%include "dolfin/common/real.h"
%include "dolfin/common/constants.h"
%include "dolfin/common/timing.h"
+%include "dolfin/common/Array.h"
%include "dolfin/common/Timer.h"
%include "dolfin/common/Variable.h"
%include "dolfin/swig/common_post.i"
@@ -103,6 +104,8 @@
%include "dolfin/mesh/MeshFunction.h"
%include "dolfin/mesh/Mesh.h"
%include "dolfin/mesh/MeshPartitioning.h"
+%include "dolfin/mesh/MeshPrimitive.h"
+%include "dolfin/mesh/Primitive_Traits.h"
%include "dolfin/mesh/LocalMeshData.h"
%include "dolfin/mesh/SubDomain.h"
%include "dolfin/mesh/SubMesh.h"
--- End Message ---