/usr/include/dolfin/generation/CSGPrimitives3D.h is in libdolfin1.3-dev 1.3.0+dfsg-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 | // Copyright (C) 2012 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/>.
//
// Modified by Benjamin Kehlet, 2012
// Modified by Johannes Ring, 2012
//
// First added: 2012-04-11
// Last changed: 2012-11-12
#ifndef __CSG_PRIMITIVES_3D_H
#define __CSG_PRIMITIVES_3D_H
#include <cstddef>
#include <dolfin/geometry/Point.h>
#include "CSGPrimitive.h"
namespace dolfin
{
/// Base class for 3D primitives
class CSGPrimitive3D : public CSGPrimitive
{
public:
/// Return dimension of geometry
std::size_t dim() const { return 3; }
};
/// This class describes a 3D sphere which can be used to build
/// geometries using Constructive Solid Geometry (CSG).
class Sphere : public CSGPrimitive3D
{
public:
/// Create sphere at x = (x0, x1, x2) with radius r.
///
/// *Arguments*
/// x0 (double)
/// x0-coordinate of center.
/// x1 (double)
/// x1-coordinate of center.
/// x2 (double)
/// x2-coordinate of center.
/// r (double)
/// radius.
Sphere(Point center, double radius, std::size_t slices=16);
/// Informal string representation
std::string str(bool verbose) const;
Type getType() const
{ return CSGGeometry::Sphere; }
const Point c;
const double r;
const std::size_t _slices;
};
/// This class describes a 3D box which can be used to build
/// geometries using Constructive Solid Geometry (CSG).
class Box : public CSGPrimitive3D
{
public:
/// Create box defined by two opposite corners
/// x = (x0, x1, x2) and y = (y0, y1, y2).
///
/// *Arguments*
/// x0 (double)
/// x0-coordinate of first corner.
/// x1 (double)
/// x1-coordinate of first corner.
/// x2 (double)
/// x2-coordinate of first corner.
/// y0 (double)
/// y0-coordinate of second corner.
/// y1 (double)
/// y1-coordinate of second corner.
/// y2 (double)
/// y2-coordinate of second corner.
Box(double x0, double x1, double x2,
double y0, double y1, double y2);
/// Informal string representation
std::string str(bool verbose) const;
Type getType() const
{ return CSGGeometry::Box; }
double _x0, _x1, _x2, _y0, _y1, _y2;
};
/// This class describes a 3D cone which can be used to build
/// geometries using Constructive Solid Geometry (CSG).
class Cone : public CSGPrimitive3D
{
public:
/// Create cone defined by upper and lower center
/// and radius respectively.
///
/// *Arguments*
/// top (Point)
/// Center at top of cone.
/// top_radius(double)
/// Radius bottom of cone.
/// bottom(Point)
/// Center at top of cone.
/// bottom_radius (double)
/// radius at top of cone.
/// slices (std::size_t)
/// number of faces on the side when generating a
/// polyhedral approximation.
Cone(Point top, Point bottom, double top_radius, double bottom_radius,
std::size_t slices=32);
/// Informal string representation
std::string str(bool verbose) const;
Type getType() const
{ return CSGGeometry::Cone; }
const Point _top, _bottom;
const double _top_radius, _bottom_radius;
const std::size_t _slices;
};
/// This class describes a 3D cylinder which can be used to build
/// geometries using Constructive Solid Geometry (CSG). A cylinder
/// is here just a special case of a cone.
class Cylinder : public Cone
{
public:
/// Create cylinder defined by upper and lower center
/// and radius respectively.
///
/// *Arguments*
/// top (Point)
/// Center at top of cylinder.
/// bottom(Point)
/// Center at top of cylinder.
/// r (double)
/// radius of cylinder.
/// slices (std::size_t)
/// number of faces on the side when generating a
/// polyhedral approximation.
Cylinder(Point top, Point bottom, double r, std::size_t slices=32)
: Cone(top, bottom, r, r, slices) {}
};
/// This class describes a Tetrahedron which can be used to build
/// geometries using Constructive Solid Geometry (CSG).
class Tetrahedron : public CSGPrimitive3D
{
public:
/// Create tetrahedron defined by four corner points.
///
/// *Arguments*
/// x0 (Point)
/// Point.
/// x1 (Point)
/// Point.
/// x2 (Point)
/// Point.
/// x3 (Point)
/// Point.
Tetrahedron(Point x0, Point x1, Point x2, Point x3);
/// Informal string representation
std::string str(bool verbose) const;
Type getType() const
{ return CSGGeometry::Tetrahedron; }
Point _x0, _x1, _x2, _x3;
};
/// This class describes a 3D surface loaded from file.
/// The supported file types
class Surface3D : public CSGPrimitive3D
{
public:
Surface3D(std::string filename);
/// Informal string representation
std::string str(bool verbose) const;
Type getType() const
{ return CSGGeometry::Surface3D; }
std::string _filename;
};
}
#endif
|