Another attempt to fix tolerances problems with goteborg.iges.
Fixed all trivial comments.
Made Asserts into AsserThrows where needed.
## ---------------------------------------------------------------------
-## $Id$
##
-## Copyright (C) 2012 - 2013 by the deal.II authors
+## Copyright (C) 2012 - 2014 by the deal.II authors
##
## This file is part of the deal.II library.
##
#ifdef DEAL_II_WITH_OPENCASCADE
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <deal.II/grid/tria_boundary.h>
#include <BRepAdaptor_Curve.hxx>
DEAL_II_NAMESPACE_OPEN
/**
- * @addtogroup OpenCASCADE
- * @{
* We collect in this namespace all utilities which operate on
* OpenCASCADE entities. OpenCASCADE splits every object into a
* topological description and a geometrical entity. The basic
* This class is used to interpolate a BsplineCurve passing through
* an array of points, with a C2 Continuity. If the optional
* parameter @p closed is set to true, then the curve will be C2 at
- * all points execpt the first (where only C1 continuity will be
+ * all points except the first (where only C1 continuity will be
* given), and it will be a closed curve.
*
* The curve is garanteed to be at distance @p tolerance from the
* input points. If the algorithm fails in generating such a curve,
* an exception is thrown.
*/
- TopoDS_Edge interpolation_curve(std::vector<dealii::Point<3> > &curve_points,
- const dealii::Point<3> direction=dealii::Point<3>(),
+ TopoDS_Edge interpolation_curve(std::vector<Point<3> > &curve_points,
+ const Tensor<1,3> &direction=Tensor<1,3>(),
const bool closed=false,
const double tolerance=1e-7);
*
* The optional @p tolerance parameter is used to compute distances.
*/
- Point<3> axis_intersection(const TopoDS_Shape in_shape,
- const Point<3> origin,
- const Point<3> direction,
+ Point<3> line_intersection(const TopoDS_Shape &in_shape,
+ const Point<3> &origin,
+ const Tensor<1,3> &direction,
const double tolerance=1e-7);
/**
* Convert OpenCASCADE point into a Point<3>.
*/
- Point<3> Pnt(const gp_Pnt &p);
+ Point<3> point(const gp_Pnt &p);
/**
* Convert Point<3> into OpenCASCADE point.
*/
- gp_Pnt Pnt(const Point<3> &p);
+ gp_Pnt point(const Point<3> &p);
/**
* Sort two points according to their scalar product with
* direction. If the norm of the direction is zero, then use
- * lexycographical ordering. The optional parameter is used as a
+ * lexicographical ordering. The optional parameter is used as a
* relative tolerance when comparing objects.
*/
- bool point_compare(const dealii::Point<3> &p1, const dealii::Point<3> &p2,
- const dealii::Point<3> direction=Point<3>(),
+ bool point_compare(const Point<3> &p1, const Point<3> &p2,
+ const Tensor<1,3> &direction=Tensor<1,3>(),
const double tolerance=1e-10);
DeclException0(ExcUnsupportedShape);
}
-/*@}*/
+
DEAL_II_NAMESPACE_CLOSE
ADD_SUBDIRECTORY(integrators)
ADD_SUBDIRECTORY(matrix_free)
ADD_SUBDIRECTORY(meshworker)
+ADD_SUBDIRECTORY(opencascade)
FOREACH(build ${DEAL_II_BUILD_TYPES})
STRING(TOLOWER ${build} build_lowercase)
intergrid_map.cc
manifold.cc
manifold_lib.cc
- occ_utilities.cc
- occ_boundary_lib.cc
persistent_tria.cc
tria_accessor.cc
tria_boundary.cc
intergrid_map.inst.in
manifold.inst.in
manifold_lib.inst.in
- occ_boundary_lib.inst.in
tria_accessor.inst.in
tria_boundary.inst.in
tria_boundary_lib.inst.in
--- /dev/null
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2012 - 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, 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 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+INCLUDE_DIRECTORIES(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+
+SET(_src
+ utilities.cc
+ boundary_lib.cc
+ )
+
+SET(_inst
+ boundary_lib.inst.in
+ )
+
+FILE(GLOB _header
+ ${CMAKE_SOURCE_DIR}/include/deal.II/opencascade/*.h
+ )
+
+DEAL_II_ADD_LIBRARY(obj_opencascade OBJECT ${_src} ${_header} ${_inst})
+EXPAND_INSTANTIATIONS(obj_opencascade "${_inst}")
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/boundary_lib.h>
#ifdef DEAL_II_WITH_OPENCASCADE
tolerance),
ExcPointNotOnManifold(surrounding_points[i]));
- return axis_intersection(sh, candidate, direction, tolerance);
+ return line_intersection(sh, candidate, direction, tolerance);
}
/*============================== ArclengthProjectionLineManifold ==============================*/
ShapeAnalysis_Curve curve_analysis;
gp_Pnt proj;
double t;
- double dist = curve_analysis.Project(curve->GetCurve(), Pnt(space_point), tolerance, proj, t, true);
+ double dist = curve_analysis.Project(curve->GetCurve(), point(space_point), tolerance, proj, t, true);
Assert(dist < tolerance*length, ExcPointNotOnManifold(space_point));
return Point<1>(GCPnts_AbscissaPoint::Length(curve->GetCurve(),curve->GetCurve().FirstParameter(),t));
}
{
GCPnts_AbscissaPoint AP(curve->GetCurve(), chart_point[0], curve->GetCurve().FirstParameter());
gp_Pnt P = curve->GetCurve().Value(AP.Parameter());
- return Pnt(P);
+ return point(P);
}
// Explicit instantiations
-#include "occ_boundary_lib.inst"
+#include "boundary_lib.inst"
} // end namespace OpenCASCADE
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#ifdef DEAL_II_WITH_OPENCASCADE
}
}
- gp_Pnt Pnt(const Point<3> &p)
+ gp_Pnt point(const Point<3> &p)
{
return gp_Pnt(p(0), p(1), p(2));
}
- Point<3> Pnt(const gp_Pnt &p)
+ Point<3> point(const gp_Pnt &p)
{
return Point<3>(p.X(), p.Y(), p.Z());
}
- bool point_compare(const dealii::Point<3> &p1, const dealii::Point<3> &p2,
- const dealii::Point<3> direction,
+ bool point_compare(const Point<3> &p1, const Point<3> &p2,
+ const Tensor<1,3> &direction,
const double tolerance)
{
const double rel_tol=std::max(tolerance, std::max(p1.norm(), p2.norm())*tolerance);
IGESControl_Reader reader;
IFSelect_ReturnStatus stat;
stat = reader.ReadFile(filename.c_str());
- Assert(stat == IFSelect_RetDone,
- ExcMessage("Error in reading file!"));
+ AssertThrow(stat == IFSelect_RetDone,
+ ExcMessage("Error in reading file!"));
Standard_Boolean failsonly = Standard_False;
IFSelect_PrintCount mode = IFSelect_ItemsByEntity;
IGESControl_Controller::Init();
IGESControl_Writer ICW ("MM", 0);
Standard_Boolean ok = ICW.AddShape (shape);
- Assert(ok, ExcMessage("Failed to add shape to IGES controller."));
+ AssertThrow(ok, ExcMessage("Failed to add shape to IGES controller."));
ICW.ComputeModel();
Standard_Boolean OK = ICW.Write (filename.c_str());
- Assert(OK, ExcMessage("Failed to write IGES file."));
+ AssertThrow(OK, ExcMessage("Failed to write IGES file."));
}
}
- Point<3> axis_intersection(const TopoDS_Shape in_shape,
- const Point<3> origin,
- const Point<3> direction,
+ Point<3> line_intersection(const TopoDS_Shape &in_shape,
+ const Point<3> &origin,
+ const Tensor<1,3> &direction,
const double tolerance)
{
// translating original Point<dim> to gp point
- gp_Pnt P0 = Pnt(origin);
- gp_Ax1 gpaxis(P0, gp_Dir(direction(0), direction(1), direction(2)));
+ gp_Pnt P0 = point(origin);
+ gp_Ax1 gpaxis(P0, gp_Dir(direction[0], direction[1], direction[2]));
gp_Lin line(gpaxis);
// destination point
Inters.PerformNearest(line,-RealLast(),+RealLast());
Assert(Inters.IsDone(), ExcMessage("Could not project point."));
- return Pnt(Inters.Pnt(1));
+ return point(Inters.Pnt(1));
}
TopoDS_Edge interpolation_curve(std::vector<Point<3> > &curve_points,
- const Point<3> direction,
+ const Tensor<1,3> &direction,
const bool closed,
const double tolerance)
{
Handle(TColgp_HArray1OfPnt) vertices = new TColgp_HArray1OfPnt(1,n_vertices);
for (unsigned int vertex=0; vertex<n_vertices; ++vertex)
{
- vertices->SetValue(vertex+1,Pnt(curve_points[vertex]));
+ vertices->SetValue(vertex+1,point(curve_points[vertex]));
}
{
TopExp_Explorer exp;
- gp_Pnt Pproj = Pnt(origin);
+ gp_Pnt Pproj = point(origin);
double minDistance = 1e7;
gp_Pnt tmp_proj(0.0,0.0,0.0);
Handle(Geom_Surface) SurfToProj = BRep_Tool::Surface(face);
ShapeAnalysis_Surface projector(SurfToProj);
- gp_Pnt2d proj_params = projector.ValueOfUV(Pnt(origin), tolerance);
+ gp_Pnt2d proj_params = projector.ValueOfUV(point(origin), tolerance);
SurfToProj->D0(proj_params.X(),proj_params.Y(),tmp_proj);
- double distance = Pnt(tmp_proj).distance(origin);
+ double distance = point(tmp_proj).distance(origin);
if (distance < minDistance)
{
minDistance = distance;
// curve upon which the edge is defined
Handle(Geom_Curve) CurveToProj = BRep_Tool::Curve(edge,L,First,Last);
- GeomAPI_ProjectPointOnCurve Proj(Pnt(origin),CurveToProj);
+ GeomAPI_ProjectPointOnCurve Proj(point(origin),CurveToProj);
unsigned int num_proj_points = Proj.NbPoints();
if ((num_proj_points > 0) && (Proj.LowerDistance() < minDistance))
{
}
Assert(counter > 0, ExcMessage("Could not find projection points."));
- return Pnt(Pproj);
+ return point(Pproj);
}
void create_triangulation(const TopoDS_Face &face,
std::vector<Point<3> > vertices;
SubCellData t;
- vertices.push_back(Pnt(surf.Value(u0,v0)));
- vertices.push_back(Pnt(surf.Value(u1,v0)));
- vertices.push_back(Pnt(surf.Value(u0,v1)));
- vertices.push_back(Pnt(surf.Value(u1,v1)));
+ vertices.push_back(point(surf.Value(u0,v0)));
+ vertices.push_back(point(surf.Value(u1,v0)));
+ vertices.push_back(point(surf.Value(u0,v1)));
+ vertices.push_back(point(surf.Value(u1,v1)));
CellData<2> cell;
for (unsigned int i=0; i<4; ++i)
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_generator.h>
#include "../tests.h"
-#include <deal.II/grid/occ_utilities.h>
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>
-
-//---------------------------- iges_read.cc ---------------------------
-// $Id: testsuite.html 13373 2006-07-13 13:12:08Z kanschat $
-// Version: $Name$
+//-----------------------------------------------------------
//
-// Copyright (C) 2005 by the deal.II authors
+// Copyright (C) 2014 by the deal.II authors
//
-// This file is subject to QPL and may not be distributed
+// This file is subject to LGPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
-//---------------------------- iges_read.cc ---------------------------
-
+//-----------------------------------------------------------
-// Read goteborg.iges and dump its topological structure to the logfile.
+// Test the class DirectionalProjectionBoundary
#include "../tests.h"
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_generator.h>
#include "../tests.h"
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>
#include "../tests.h"
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <base/logstream.h>
#include <grid/tria.h>
#include "../tests.h"
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>
{
std::ofstream logfile("output");
- TopoDS_Shape sh = read_IGES(SOURCE_DIR "/iges_files/goteborg.iges");
+ TopoDS_Shape sh = read_IGES(SOURCE_DIR "/iges_files/goteborg.iges", 1);
std::vector<TopoDS_Face> faces;
std::vector<TopoDS_Edge> edges;
std::vector<TopoDS_Vertex> vertices;
$NOD
25
-1 -1.98714 1.02631e-19 -0.149998
-2 -2.63758 -6.93889e-18 -0.249603
-3 -2.00886 0.314666 0.428234
-4 -3.05955 0 0.501418
-5 -2.30472 0 -0.245614
-6 -2.00073 0.167844 0.134255
-7 -2.72534 4.25119e-05 0.204053
-8 -2.54605 0.193924 0.440052
-9 -2.40412 0.0655112 0.139204
-10 -2.14241 8.03383e-19 -0.216122
-11 -2.46936 -3.70788e-20 -0.267918
-12 -1.99609 0.0965804 -0.0146004
-13 -2.00426 0.238868 0.282461
-14 -2.63221 9.34116e-07 -0.0158842
-15 -2.87756 -5.67114e-09 0.370719
-16 -2.27934 0.26212 0.42932
-17 -2.80896 0.111433 0.459585
-18 -2.35424 0.031169 -0.0529932
-19 -2.47235 0.120909 0.295137
-20 -2.20235 0.116409 0.136836
-21 -2.56575 0.0372536 0.170331
-22 -2.17413 0.0607452 -0.0340272
-23 -2.51144 0.0146272 -0.0396781
-24 -2.23928 0.183308 0.286763
-25 -2.68303 0.0677305 0.321656
+1 -1986.99 -2.3276e-17 -149.998
+2 -2637.58 3.55271e-15 -249.603
+3 -2008.61 314.696 428.208
+4 -3059.55 1.42109e-14 501.418
+5 -2304.65 -7.10543e-15 -245.601
+6 -2000.53 167.884 134.23
+7 -2725.34 0.0425119 204.053
+8 -2545.92 193.951 440.032
+9 -2404.02 65.5321 139.195
+10 -2142.3 -5.17421e-15 -216.101
+11 -2469.32 0 -267.915
+12 -1995.92 96.6019 -14.6159
+13 -2004.03 238.906 282.434
+14 -2632.21 0.000934116 -15.8842
+15 -2877.56 -5.67115e-09 370.719
+16 -2279.15 262.151 429.296
+17 -2808.9 111.45 459.573
+18 -2354.15 31.1791 -52.9914
+19 -2472.24 120.934 295.122
+20 -2202.2 116.44 136.819
+21 -2565.7 37.2635 170.327
+22 -2173.99 60.762 -34.0318
+23 -2511.39 14.632 -39.6776
+24 -2239.11 183.341 286.741
+25 -2682.97 67.745 321.647
$ENDNOD
$ELM
16
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <deal.II/grid/tria.h>
#include <deal.II/grid/grid_out.h>
#include <deal.II/grid/grid_generator.h>
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <TopTools.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Stream.hxx>
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <TopTools.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Stream.hxx>
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <TopTools.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Stream.hxx>
+++ /dev/null
-//-----------------------------------------------------------
-//
-// Copyright (C) 2014 by the deal.II authors
-//
-// This file is subject to LGPL and may not be distributed
-// without copyright and license information. Please refer
-// to the file deal.II/doc/license.html for the text and
-// further information on this license.
-//
-//-----------------------------------------------------------
-
-// Read goteborg.iges and dump its topological structure to the
-// logfile.
-
-#include "../tests.h"
-#include <fstream>
-#include <base/logstream.h>
-
-#include <deal.II/grid/occ_utilities.h>
-#include <TopTools.hxx>
-#include <TopoDS_Shape.hxx>
-#include <Standard_Stream.hxx>
-
-using namespace OpenCASCADE;
-
-int main ()
-{
- std::ofstream logfile("output");
- deallog.attach(logfile);
- deallog.depth_console(0);
-
- TopoDS_Shape sh = read_IGES(SOURCE_DIR "/iges_files/goteborg.iges");
- unsigned int nf=0, ne=0, nv=0;
- count_elements(sh, nf, ne, nv);
- deallog << "Shape contains " << nf << " faces, "
- << ne << " edges, and "
- << nv << " vertices." << std::endl;
-
- return 0;
-}
-
+++ /dev/null
-
-DEAL::Shape contains 3 faces, 12 edges, and 24 vertices.
#include <fstream>
#include <base/logstream.h>
-#include <deal.II/grid/occ_utilities.h>
+#include <deal.II/opencascade/utilities.h>
#include <TopTools.hxx>
#include <TopoDS_Shape.hxx>
#include <Standard_Stream.hxx>
#include "../tests.h"
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>
#include "../tests.h"
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>
#include "../tests.h"
-#include <deal.II/grid/occ_utilities.h>
-#include <deal.II/grid/occ_boundary_lib.h>
+#include <deal.II/opencascade/utilities.h>
+#include <deal.II/opencascade/boundary_lib.h>
#include <fstream>
#include <base/logstream.h>