/usr/include/deal.II/grid/tria_boundary_lib.h is in libdeal.ii-dev 6.3.1-1.1.
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 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 | //---------------------------------------------------------------------------
// $Id: tria_boundary_lib.h 19303 2009-08-18 12:49:00Z bangerth $
// Version: $Name$
//
// Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2009 by the deal.II authors
//
// This file is subject to QPL 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.
//
//---------------------------------------------------------------------------
#ifndef __deal2__tria_boundary_lib_h
#define __deal2__tria_boundary_lib_h
#include <base/config.h>
#include <grid/tria_boundary.h>
DEAL_II_NAMESPACE_OPEN
/**
* Boundary object for the hull of a cylinder. In three dimensions,
* points are projected on a circular tube along the <tt>x-</tt>,
* <tt>y-</tt> or <tt>z</tt>-axis (when using the first constructor of
* this class), or an arbitrarily oriented cylinder described by the
* direction of its axis and a point located on the axis. The radius
* of the tube can be given independently. Similar to
* HyperBallBoundary, new points are projected by dividing the
* straight line between the old two points and adjusting the radius
* from the axis.
*
* This class was developed to be used in conjunction with the
* @p cylinder function of GridGenerator. It should be used for
* the hull of the cylinder only (boundary indicator 0).
*
* This class is derived from StraightBoundary rather than from
* Boundary, which would seem natural, since this way we can use the
* StraightBoundary::in_between() function.
*
* @ingroup boundary
*
* @author Guido Kanschat, 2001, Wolfgang Bangerth, 2007
*/
template <int dim>
class CylinderBoundary : public StraightBoundary<dim>
{
public:
/**
* Constructor. Per default
* circular tube along the x-axis
* (<tt>axis=0</tt>). Choose
* <tt>axis=1</tt> or
* <tt>axis=2</tt> for a tube
* along the y- or z-axis,
* respectively.
*/
CylinderBoundary (const double radius = 1.0,
const unsigned int axis = 0);
/**
* Constructor. If constructed
* with this constructor, the
* boundary described is a
* cylinder with an axis that
* points in direction #direction
* and goes through the given
* #point_on_axis. The direction
* may be arbitrarily scaled, and
* the given point may be any
* point on the axis.
*/
CylinderBoundary (const double radius,
const Point<dim> direction,
const Point<dim> point_on_axis);
/**
* Refer to the general documentation of
* this class and the documentation of the
* base class.
*/
virtual Point<dim>
get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const;
/**
* Refer to the general documentation of
* this class and the documentation of the
* base class.
*/
virtual Point<dim>
get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Calls
* @p get_intermediate_points_between_points.
*/
virtual void
get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
std::vector<Point<dim> > &points) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Only implemented for <tt>dim=3</tt>
* and for <tt>points.size()==1</tt>.
*/
virtual void
get_intermediate_points_on_quad (const typename Triangulation<dim>::quad_iterator &quad,
std::vector<Point<dim> > &points) const;
/**
* Compute the normals to the
* boundary at the vertices of
* the given face.
*
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual void
get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
typename Boundary<dim>::FaceVertexNormals &face_vertex_normals) const;
/**
* Return the radius of the cylinder.
*/
double get_radius () const;
/**
* Exception. Thrown by the
* @p get_radius if the
* @p compute_radius_automatically,
* see below, flag is set true.
*/
DeclException0 (ExcRadiusNotSet);
protected:
/**
* Radius of the cylinder.
*/
const double radius;
/**
* The direction vector of the axis.
*/
const Point<dim> direction;
/**
* An arbitrary point on the axis.
*/
const Point<dim> point_on_axis;
private:
/**
* Called by
* @p get_intermediate_points_on_line
* and by
* @p get_intermediate_points_on_quad.
*
* Refer to the general
* documentation of
* @p get_intermediate_points_on_line
* in the documentation of the
* base class.
*/
void get_intermediate_points_between_points (const Point<dim> &p0, const Point<dim> &p1,
std::vector<Point<dim> > &points) const;
/**
* Given a number for the axis,
* return a vector that denotes
* this direction.
*/
static Point<dim> get_axis_vector (const unsigned int axis);
};
/**
* Boundary object for the hull of a (truncated) cone with two
* different radii at the two ends. If one radius is chosen to be 0
* the object describes the boundary of a cone. In three dimensions,
* points are projected on an arbitrarily oriented (truncated) cone
* described by the two endpoints and the corresponding radii. Similar
* to HyperBallBoundary, new points are projected by dividing the
* straight line between the old two points and adjusting the radius
* from the axis.
*
* This class is derived from StraightBoundary rather than from
* Boundary, which would seem natural, since this way we can use the
* StraightBoundary::in_between() function.
*
* As an example of use, consider the following code snippet:
* @code
* Triangulation<dim> triangulation;
* GridGenerator::truncated_cone (triangulation);
* Point<dim> p1, p2;
* p1[0] = -1;
* p2[0] = 1;
* const ConeBoundary<dim> boundary (1, 0.5, p1, p2);
* triangulation.set_boundary (0, boundary);
* triangulation.refine_global (2);
* @endcode
* This will produce the following meshes after the two
* refinements we perform, in 2d and 3d, respectively:
*
* @image html cone_2d.png
* @image html cone_3d.png
*
* @author Markus Bürg, 2009
*/
template <int dim>
class ConeBoundary : public StraightBoundary<dim>
{
public:
/**
* Constructor. Here the boundary
* object is constructed. The
* points <tt>x_0</tt> and
* <tt>x_1</tt> describe the
* starting and ending points of
* the axis of the (truncated)
* cone. <tt>radius_0</tt>
* denotes the radius
* corresponding to <tt>x_0</tt>
* and <tt>radius_1</tt> the one
* corresponding to <tt>x_1</tt>.
*/
ConeBoundary (const double radius_0,
const double radius_1,
const Point<dim> x_0,
const Point<dim> x_1);
/**
* Return the radius of the
* (truncated) cone at given point
* <tt>x</tt> on the axis.
*/
double get_radius (const Point<dim> x) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual
Point<dim>
get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual
Point<dim>
get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Calls @p
* get_intermediate_points_between_points.
*/
virtual
void
get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
std::vector<Point<dim> > &points) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Only implemented for
* <tt>dim=3</tt> and for
* <tt>points.size()==1</tt>.
*/
virtual
void
get_intermediate_points_on_quad (const typename Triangulation<dim>::quad_iterator &quad,
std::vector<Point<dim> > &points) const;
/**
* Compute the normals to the
* boundary at the vertices of
* the given face.
*
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual
void
get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
typename Boundary<dim>::FaceVertexNormals &face_vertex_normals) const;
protected:
/**
* First radius of the (truncated)
* cone.
*/
const double radius_0;
/**
* Second radius of the (truncated)
* cone.
*/
const double radius_1;
/**
* Starting point of the axis.
*/
const Point<dim> x_0;
/**
* Ending point of the axis.
*/
const Point<dim> x_1;
private:
/**
* Called by @p
* get_intermediate_points_on_line
* and by @p
* get_intermediate_points_on_quad.
*
* Refer to the general
* documentation of @p
* get_intermediate_points_on_line
* in the documentation of the
* base class.
*/
void
get_intermediate_points_between_points (const Point<dim> &p0,
const Point<dim> &p1,
std::vector<Point<dim> > &points) const;
};
/**
* Specialization of Boundary<dim>, which places the new point on
* the boundary of a ball in arbitrary dimension. It works by projecting
* the point in the middle of the old points onto the ball. The middle is
* defined as the arithmetic mean of the points.
*
* The center of the ball and its radius may be given upon construction of
* an object of this type. They default to the origin and a radius of 1.0.
*
* This class is derived from StraightBoundary rather than from
* Boundary, which would seem natural, since this way we can use the
* StraightBoundary::in_between() function.
*
* @ingroup boundary
*
* @author Wolfgang Bangerth, 1998, Ralf Hartmann, 2001
*/
template <int dim, int spacedim=dim>
class HyperBallBoundary : public StraightBoundary<dim,spacedim>
{
public:
/**
* Constructor
*/
HyperBallBoundary (const Point<spacedim> p = Point<spacedim>(),
const double radius = 1.0);
/**
* Refer to the general documentation of
* this class and the documentation of the
* base class.
*/
virtual Point<spacedim>
get_new_point_on_line (const typename Triangulation<dim,spacedim>::line_iterator &line) const;
/**
* Refer to the general documentation of
* this class and the documentation of the
* base class.
*/
virtual Point<spacedim>
get_new_point_on_quad (const typename Triangulation<dim,spacedim>::quad_iterator &quad) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Calls
* @p get_intermediate_points_between_points.
*/
virtual void
get_intermediate_points_on_line (const typename Triangulation<dim,spacedim>::line_iterator &line,
std::vector<Point<spacedim> > &points) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Only implemented for <tt>dim=3</tt>
* and for <tt>points.size()==1</tt>.
*/
virtual void
get_intermediate_points_on_quad (const typename Triangulation<dim,spacedim>::quad_iterator &quad,
std::vector<Point<spacedim> > &points) const;
/**
* Compute the normals to the
* boundary at the vertices of
* the given face.
*
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual void
get_normals_at_vertices (const typename Triangulation<dim,spacedim>::face_iterator &face,
typename Boundary<dim,spacedim>::FaceVertexNormals &face_vertex_normals) const;
/**
* Return the center of the ball.
*/
Point<spacedim> get_center () const;
/**
* Return the radius of the ball.
*/
double get_radius () const;
/**
* Exception. Thrown by the
* @p get_radius if the
* @p compute_radius_automatically,
* see below, flag is set true.
*/
DeclException0 (ExcRadiusNotSet);
protected:
/**
* Center point of the hyperball.
*/
const Point<spacedim> center;
/**
* Radius of the hyperball.
*/
const double radius;
/**
* This flag is @p false for
* this class and for all derived
* classes that set the radius by
* the constructor. For example
* this flag is @p false for the
* HalfHyperBallBoundary
* class but it is @p true for
* the HyperShellBoundary
* class, for example. The
* latter class doesn't get its
* radii by the constructor but
* need to compute the radii
* automatically each time one of
* the virtual functions is
* called.
*/
bool compute_radius_automatically;
private:
/**
* Called by
* @p get_intermediate_points_on_line
* and by
* @p get_intermediate_points_on_quad.
*
* Refer to the general
* documentation of
* @p get_intermediate_points_on_line
* in the documentation of the
* base class.
*/
void get_intermediate_points_between_points (const Point<spacedim> &p0, const Point<spacedim> &p1,
std::vector<Point<spacedim> > &points) const;
};
/**
* Variant of HyperBallBoundary which denotes a half hyper ball
* where the first coordinate is restricted to the range $x>=0$ (or
* $x>=center(0)$). In two dimensions, this equals the right half
* circle, in three space dimensions it is a half ball. This class
* might be useful for computations with rotational symmetry, where
* one dimension is the radius from the axis of rotation.
*
* @ingroup boundary
*
* @author Wolfgang Bangerth, 1999, 2001
*/
template <int dim>
class HalfHyperBallBoundary : public HyperBallBoundary<dim>
{
public:
/**
* Constructor
*/
HalfHyperBallBoundary (const Point<dim> p = Point<dim>(),
const double radius = 1.0);
/**
* Check if on the line <tt>x==0</tt>,
* otherwise pass to the base
* class.
*/
virtual Point<dim>
get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const;
/**
* Check if on the line <tt>x==0</tt>,
* otherwise pass to the base
* class.
*/
virtual Point<dim>
get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Calls
* @p get_intermediate_points_between_points.
*/
virtual void
get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
std::vector<Point<dim> > &points) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Only implemented for <tt>dim=3</tt>
* and for <tt>points.size()==1</tt>.
*/
virtual void
get_intermediate_points_on_quad (const typename Triangulation<dim>::quad_iterator &quad,
std::vector<Point<dim> > &points) const;
/**
* Compute the normals to the
* boundary at the vertices of
* the given face.
*
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual void
get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
typename Boundary<dim>::FaceVertexNormals &face_vertex_normals) const;
};
/**
* Class describing the boundaries of a hyper shell. Only the center
* of the two spheres needs to be given, the radii of inner and outer
* sphere are computed automatically upon calling one of the virtual
* functions.
*
* @ingroup boundary
*
* @author Wolfgang Bangerth, 1999
*/
template <int dim>
class HyperShellBoundary : public HyperBallBoundary<dim>
{
public:
/**
* Constructor. The center of the
* spheres defaults to the
* origin.
*
* Calls the constructor of its
* base @p HyperBallBoundary
* class with a dummy radius as
* argument. This radius will be
* ignored
*/
HyperShellBoundary (const Point<dim> ¢er = Point<dim>());
};
/**
* Variant of HyperShellBoundary which denotes a half hyper shell
* where the first coordinate is restricted to the range $x>=0$ (or
* $x>=center(0)$). In two dimensions, this equals the right half arc,
* in three space dimensions it is a half shell. This class might be
* useful for computations with rotational symmetry, where one
* dimension is the radius from the axis of rotation.
*
* @ingroup boundary
*
* @author Wolfgang Bangerth, 2000, 2009
*/
template <int dim>
class HalfHyperShellBoundary : public HyperShellBoundary<dim>
{
public:
/**
* Constructor. The center of the
* spheres defaults to the
* origin.
*
* If the radii are not specified, the
* class tries to infer them from the
* location of points on the
* boundary. This works in 2d, but not in
* 3d. As a consequence, in 3d these
* radii must be given.
*/
HalfHyperShellBoundary (const Point<dim> ¢er = Point<dim>(),
const double inner_radius = -1,
const double outer_radius = -1);
/**
* Construct a new point on a line.
*/
virtual Point<dim>
get_new_point_on_line (const typename Triangulation<dim>::line_iterator &line) const;
/**
* Construct a new point on a quad.
*/
virtual Point<dim>
get_new_point_on_quad (const typename Triangulation<dim>::quad_iterator &quad) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Calls
* @p get_intermediate_points_between_points.
*/
virtual void
get_intermediate_points_on_line (const typename Triangulation<dim>::line_iterator &line,
std::vector<Point<dim> > &points) const;
/**
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*
* Only implemented for <tt>dim=3</tt>
* and for <tt>points.size()==1</tt>.
*/
virtual void
get_intermediate_points_on_quad (const typename Triangulation<dim>::quad_iterator &quad,
std::vector<Point<dim> > &points) const;
/**
* Compute the normals to the
* boundary at the vertices of
* the given face.
*
* Refer to the general
* documentation of this class
* and the documentation of the
* base class.
*/
virtual void
get_normals_at_vertices (const typename Triangulation<dim>::face_iterator &face,
typename Boundary<dim>::FaceVertexNormals &face_vertex_normals) const;
private:
/**
* Inner and outer radii of the shell.
*/
const double inner_radius;
const double outer_radius;
};
/* -------------- declaration of explicit specializations ------------- */
#ifndef DOXYGEN
template <>
Point<1>
HyperBallBoundary<1>::
get_new_point_on_quad (const Triangulation<1>::quad_iterator &) const;
template <>
void
HyperBallBoundary<1>::get_intermediate_points_on_line (
const Triangulation<1>::line_iterator &,
std::vector<Point<1> > &) const;
template <>
void
HyperBallBoundary<3>::get_intermediate_points_on_quad (
const Triangulation<3>::quad_iterator &quad,
std::vector<Point<3> > &points) const;
template <>
void
HyperBallBoundary<1>::
get_normals_at_vertices (const Triangulation<1>::face_iterator &,
Boundary<1>::FaceVertexNormals &) const;
template <>
Point<1>
HalfHyperBallBoundary<1>::
get_new_point_on_quad (const Triangulation<1>::quad_iterator &) const;
template <>
void
HalfHyperBallBoundary<1>::
get_intermediate_points_on_quad (const Triangulation<1>::quad_iterator &,
std::vector<Point<1> > &) const;
template <>
void
HalfHyperBallBoundary<1>::
get_normals_at_vertices (const Triangulation<1>::face_iterator &,
Boundary<1>::FaceVertexNormals &) const;
template <>
Point<1>
HalfHyperShellBoundary<1>::
get_new_point_on_quad (const Triangulation<1>::quad_iterator &) const;
template <>
void
HalfHyperShellBoundary<1>::
get_intermediate_points_on_quad (const Triangulation<1>::quad_iterator &,
std::vector<Point<1> > &) const;
template <>
void
HalfHyperShellBoundary<1>::
get_normals_at_vertices (const Triangulation<1>::face_iterator &,
Boundary<1>::FaceVertexNormals &) const;
#endif // DOXYGEN
DEAL_II_NAMESPACE_CLOSE
#endif
|