/usr/include/rheolef/domain_indirect.h is in librheolef-dev 6.7-6.
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 | #ifndef _RHEOLEF_DOMAIN_MASK_H
#define _RHEOLEF_DOMAIN_MASK_H
///
/// This file is part of Rheolef.
///
/// Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
///
/// Rheolef is free software; you can redistribute it and/or modify
/// it under the terms of the GNU General Public License as published by
/// the Free Software Foundation; either version 2 of the License, or
/// (at your option) any later version.
///
/// Rheolef 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 General Public License for more details.
///
/// You should have received a copy of the GNU General Public License
/// along with Rheolef; if not, write to the Free Software
/// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
///
/// =========================================================================
#include "rheolef/disarray.h"
#include "rheolef/geo_element.h"
#include "rheolef/geo_element_indirect.h"
#include "rheolef/index_set.h"
namespace rheolef {
// foward declarations:
template <class U, class M> class geo_rep;
template <class U, class M> class geo_basic;
// ==================================================================================
// 1) domain_indirect
// representation: domain_indirect_base_rep<M> and domain_indirect_rep<M>
// ==================================================================================
template <class M>
class domain_indirect_base_rep : public disarray<geo_element_indirect,M> {
public:
// typedefs:
typedef disarray<geo_element_indirect,M> base;
typedef typename geo_element_indirect::size_type size_type;
typedef typename geo_element_indirect::orientation_type orientation_type;
typedef typename base::iterator iterator_ioige;
typedef typename base::const_iterator const_iterator_ioige;
// allocators:
domain_indirect_base_rep();
void resize (size_type n) { base::resize (n); }
// build from a table of element indexes
domain_indirect_base_rep (const std::string& name, size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list);
void build_from_list (const std::string& name, size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list);
// c := a union b with c=*this
void build_union (
const domain_indirect_base_rep<M>& a,
const domain_indirect_base_rep<M>& b);
// accessors & modifiers:
size_type size() const { return base::size(); }
size_type dis_size() const { return base::dis_size(); }
const_iterator_ioige ioige_begin() const { return base::begin(); }
const_iterator_ioige ioige_end() const { return base::end(); }
iterator_ioige ioige_begin() { return base::begin(); }
iterator_ioige ioige_end() { return base::end(); }
const geo_element_indirect& oige (size_type ioige) const { return base::operator[] (ioige); }
std::string name () const { return _name; }
size_type map_dimension () const { return _map_dim; }
void set_name (std::string name) { _name = name; }
void set_map_dimension (size_type map_dim) { _map_dim = map_dim; }
protected:
// data:
std::string _name;
size_type _map_dim;
};
template <class M>
inline
domain_indirect_base_rep<M>::domain_indirect_base_rep()
: disarray<geo_element_indirect,M>(),
_name(),
_map_dim(0)
{
}
// ---------------------------------------------------------------------
template <class M> class domain_indirect_rep {};
template<>
class domain_indirect_rep<sequential> : public domain_indirect_base_rep<sequential> {
public:
// typedefs:
typedef domain_indirect_base_rep<sequential> base;
typedef base::size_type size_type;
typedef base::iterator_ioige iterator_ioige;
typedef base::const_iterator_ioige const_iterator_ioige;
typedef base::orientation_type orientation_type;
// allocators:
domain_indirect_rep () : domain_indirect_base_rep<sequential>() {}
domain_indirect_rep (
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list)
: domain_indirect_base_rep<sequential>(name, map_dim, comm, ie_list) {}
void resize (size_type n) { base::resize (n); }
// c := a union b with c=*this
void build_union (
const domain_indirect_rep<sequential>& a,
const domain_indirect_rep<sequential>& b);
// accessors:
size_type size() const { return base::size(); }
size_type dis_size() const { return base::dis_size(); }
const_iterator_ioige ioige_begin() const { return base::ioige_begin(); }
const_iterator_ioige ioige_end() const { return base::ioige_end(); }
iterator_ioige ioige_begin() { return base::ioige_begin(); }
iterator_ioige ioige_end() { return base::ioige_end(); }
const geo_element_indirect& oige (size_type ioige) const {
return base::oige (ioige); }
void set_name (std::string name) { base::set_name(name); }
void set_map_dimension (size_type map_dim) { base::set_map_dimension(map_dim); }
std::string name () const { return base::name(); }
size_type map_dimension () const { return base::map_dimension(); }
// i/o:
template<class U>
void build_from_data (
const geo_rep<U,sequential>& omega,
disarray<geo_element_auto<heap_allocator<size_type> >,sequential, heap_allocator<size_type> >&
d_tmp,
std::vector<index_set>* ball);
template <class U>
idiststream& get (
idiststream& ips,
const geo_rep<U,sequential>& omega,
std::vector<index_set>* ball);
odiststream& put (odiststream& ops) const;
};
// c := a union b with c=*this
inline
void
domain_indirect_rep<sequential>::build_union (
const domain_indirect_rep<sequential>& a,
const domain_indirect_rep<sequential>& b)
{
base::build_union (a,b);
}
// ---------------------------------------------------------------------
#ifdef _RHEOLEF_HAVE_MPI
template<>
class domain_indirect_rep<distributed> : public domain_indirect_base_rep<distributed> {
public:
// typedefs:
typedef domain_indirect_base_rep<distributed> base;
typedef base::size_type size_type;
typedef base::iterator_ioige iterator_ioige;
typedef base::const_iterator_ioige const_iterator_ioige;
typedef base::orientation_type orientation_type;
// allocators:
domain_indirect_rep();
template<class T>
domain_indirect_rep (
const geo_basic<T,distributed>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list);
template<class T>
void init_ios (const geo_basic<T,distributed>& omega);
// c := a union b with c=*this
template<class T>
void build_union (
const geo_basic<T,distributed>& omega,
const domain_indirect_rep<distributed>& a,
const domain_indirect_rep<distributed>& b);
// accessors & modifiers:
size_type size() const { return base::size(); }
size_type dis_size() const { return base::dis_size(); }
const geo_element_indirect& oige (size_type ioige) const {
return base::oige (ioige); }
void set_name (std::string name) { base::set_name(name); }
void set_map_dimension (size_type map_dim) { base::set_map_dimension(map_dim); }
std::string name () const { return base::name(); }
size_type map_dimension () const { return base::map_dimension(); }
// distributed specific acessors:
const distributor& ini_ownership () const { return _ini_ioige2dis_ioige.ownership(); }
size_type ioige2ini_dis_ioige (size_type ioige) const { return _ioige2ini_dis_ioige [ioige]; }
size_type ini_ioige2dis_ioige (size_type ini_ioige) const { return _ini_ioige2dis_ioige [ini_ioige]; }
// i/o:
template <class U>
idiststream& get (idiststream& ips, const geo_rep<U,distributed>& omega);
template <class U>
odiststream& put (odiststream& ops, const geo_rep<U,distributed>& omega) const;
protected:
template <class U1,class M1> friend class geo_rep; // for geo_rep::build_from_domain
// data:
disarray<size_type,distributed> _ioige2ini_dis_ioige;
disarray<size_type,distributed> _ini_ioige2dis_ioige;
};
inline
domain_indirect_rep<distributed>::domain_indirect_rep()
: domain_indirect_base_rep<distributed>(),
_ioige2ini_dis_ioige(),
_ini_ioige2dis_ioige()
{
}
template<class T>
inline
domain_indirect_rep<distributed>::domain_indirect_rep (
const geo_basic<T,distributed>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list)
: domain_indirect_base_rep<distributed>(name, map_dim, comm, ie_list),
_ioige2ini_dis_ioige(),
_ini_ioige2dis_ioige()
{
init_ios (omega);
}
// c := a union b with c=*this
template<class T>
inline
void
domain_indirect_rep<distributed>::build_union (
const geo_basic<T,distributed>& omega,
const domain_indirect_rep<distributed>& a,
const domain_indirect_rep<distributed>& b)
{
base::build_union (a,b);
init_ios (omega);
}
#endif // _RHEOLEF_HAVE_MPI
// ====================================================================
// 2) wrapper: domain_indirect_basic<M>
// ====================================================================
/*Class:domain_indirect
NAME: @code{domain_indirect} - a named part of a finite element mesh
@cindex mesh boundary
@clindex domain_indirect
DESCRIPTION:
@noindent
The @code{domain_indirect} class defines a container for a part of a
finite element mesh.
This describes the connectivity of edges or faces.
This class is usefull for boundary condition setting.
IMPLEMENTATION NOTE:
The @code{domain} class is splitted into two parts.
The first one is the @code{domain_indirect} class, that contains the main
renumbering features: it acts as a indirect on a @code{geo} class(@pxref{geo class}).
The second one is the @code{domain} class, that simply contains two
smart_pointers: one on a @code{domain_indirect} and the second on the
@code{geo} where renumbering is acting.
Thus, the domain class develops a complete @code{geo}-like interface,
via the @code{geo_abstract_rep} pure virtual class derivation,
and can be used by the @code{space} class (@pxref{space class}).
The split between domain_indirect and domain is necessary,
because the @code{geo} class contains a list of domain_indirect.
It cannot contains a list of @code{domain} classes, that refers
to the geo class itself: a loop in reference counting
leads to a blocking situation in the automatic deallocation.
DATE: 12 may 1997
End:
*/
/// @brief the finite element boundary domain
template <class M = rheo_default_memory_model>
class domain_indirect_basic {
public:
};
typedef domain_indirect_basic<rheo_default_memory_model> domain_indirect;
// ---------------------------------------------------------------------
//<verbatim:
template <>
class domain_indirect_basic<sequential> : public smart_pointer<domain_indirect_rep<sequential> > {
public:
// typedefs:
typedef domain_indirect_rep<sequential> rep;
typedef smart_pointer<rep> base;
typedef rep::size_type size_type;
typedef rep::iterator_ioige iterator_ioige;
typedef rep::const_iterator_ioige const_iterator_ioige;
// allocators:
domain_indirect_basic ();
template <class T>
domain_indirect_basic (
const geo_basic<T,sequential>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list);
template <class U>
domain_indirect_basic (
disarray<geo_element_auto<heap_allocator<size_type> >,sequential, heap_allocator<size_type> >&
d_tmp,
const geo_basic<U, sequential>& omega,
std::vector<index_set>* ball);
void resize (size_type n);
// accessors:
size_type size() const;
size_type dis_size() const;
const distributor& ownership() const;
const_iterator_ioige ioige_begin() const;
const_iterator_ioige ioige_end() const;
iterator_ioige ioige_begin();
iterator_ioige ioige_end();
const geo_element_indirect& oige (size_type ioige) const;
void set_name (std::string name);
void set_map_dimension (size_type map_dim);
std::string name () const;
size_type map_dimension () const;
// i/o:
odiststream& put (odiststream&) const;
template <class T>
idiststream& get (idiststream& ips, const geo_rep<T,sequential>& omega, std::vector<index_set> *ball);
};
//>verbatim:
inline
domain_indirect_basic<sequential>::domain_indirect_basic ()
: smart_pointer<rep> (new_macro(rep))
{
}
template<class T>
inline
domain_indirect_basic<sequential>::domain_indirect_basic (
const geo_basic<T,sequential>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list)
: smart_pointer<rep> (new_macro(rep(name, map_dim, comm, ie_list)))
{
}
inline
void
domain_indirect_basic<sequential>::resize (size_type n)
{
return base::data().resize (n);
}
inline
domain_indirect_basic<sequential>::size_type
domain_indirect_basic<sequential>::size() const
{
return base::data().size();
}
inline
domain_indirect_basic<sequential>::size_type
domain_indirect_basic<sequential>::dis_size() const
{
return base::data().dis_size();
}
inline
const distributor&
domain_indirect_basic<sequential>::ownership() const
{
return base::data().ownership();
}
inline
const geo_element_indirect&
domain_indirect_basic<sequential>::oige (size_type ioige) const
{
return base::data().oige (ioige);
}
inline
domain_indirect_basic<sequential>::const_iterator_ioige
domain_indirect_basic<sequential>::ioige_begin() const
{
return base::data().ioige_begin();
}
inline
domain_indirect_basic<sequential>::const_iterator_ioige
domain_indirect_basic<sequential>::ioige_end() const
{
return base::data().ioige_end();
}
inline
domain_indirect_basic<sequential>::iterator_ioige
domain_indirect_basic<sequential>::ioige_begin()
{
return base::data().ioige_begin();
}
inline
domain_indirect_basic<sequential>::iterator_ioige
domain_indirect_basic<sequential>::ioige_end()
{
return base::data().ioige_end();
}
inline
std::string
domain_indirect_basic<sequential>::name() const
{
return base::data().name();
}
inline
domain_indirect_basic<sequential>::size_type
domain_indirect_basic<sequential>::map_dimension() const
{
return base::data().map_dimension();
}
inline
void
domain_indirect_basic<sequential>::set_name(std::string name)
{
return base::data().set_name (name);
}
inline
void
domain_indirect_basic<sequential>::set_map_dimension (size_type map_dim)
{
return base::data().set_map_dimension (map_dim);
}
inline
odiststream&
domain_indirect_basic<sequential>::put (odiststream& ops) const
{
return base::data().put (ops);
}
template<class T>
inline
idiststream&
domain_indirect_basic<sequential>::get (
idiststream& ips,
const geo_rep<T,sequential>& omega,
std::vector<index_set> *ball)
{
return base::data().template get (ips, omega, ball);
}
// union:
template<class T>
inline
domain_indirect_basic<sequential>
build_union (
const geo_basic<T,sequential>& omega,
const domain_indirect_basic<sequential>& a,
const domain_indirect_basic<sequential>& b)
{
domain_indirect_basic<sequential> c;
c.data().build_union (a.data(), b.data());
return c;
}
// ---------------------------------------------------------------------
#ifdef _RHEOLEF_HAVE_MPI
//<verbatim:
template <>
class domain_indirect_basic<distributed> : public smart_pointer<domain_indirect_rep<distributed> > {
public:
// typedefs:
typedef domain_indirect_rep<distributed> rep;
typedef smart_pointer<rep> base;
typedef rep::size_type size_type;
typedef rep::iterator_ioige iterator_ioige;
typedef rep::const_iterator_ioige const_iterator_ioige;
// allocators:
domain_indirect_basic ();
template<class T>
domain_indirect_basic (
const geo_basic<T,distributed>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list);
// accessors/modifiers:
size_type size() const;
size_type dis_size() const;
const distributor& ownership() const;
const geo_element_indirect& oige (size_type ioige) const;
void set_name (std::string name);
void set_map_dimension (size_type map_dim);
std::string name () const;
size_type map_dimension () const;
// distributed specific acessors:
const_iterator_ioige ioige_begin() const;
const_iterator_ioige ioige_end() const;
iterator_ioige ioige_begin();
iterator_ioige ioige_end();
const distributor& ini_ownership() const;
size_type ioige2ini_dis_ioige (size_type ioige) const;
size_type ini_ioige2dis_ioige (size_type ini_ioige) const;
// i/o:
template <class T>
idiststream& get (idiststream& ips, const geo_rep<T,distributed>& omega);
template <class T>
odiststream& put (odiststream& ops, const geo_rep<T,distributed>& omega) const;
};
//>verbatim:
inline
domain_indirect_basic<distributed>::domain_indirect_basic ()
: smart_pointer<rep> (new_macro(rep))
{
}
template<class T>
inline
domain_indirect_basic<distributed>::domain_indirect_basic (
const geo_basic<T,distributed>& omega,
const std::string& name,
size_type map_dim,
const communicator& comm,
const std::vector<size_type>& ie_list)
: smart_pointer<rep> (new_macro(rep(omega, name, map_dim, comm, ie_list)))
{
}
inline
domain_indirect_basic<distributed>::size_type
domain_indirect_basic<distributed>::size() const
{
return base::data().size();
}
inline
domain_indirect_basic<distributed>::size_type
domain_indirect_basic<distributed>::dis_size() const
{
return base::data().dis_size();
}
inline
const distributor&
domain_indirect_basic<distributed>::ownership() const
{
return base::data().ownership();
}
template<class T>
inline
idiststream&
domain_indirect_basic<distributed>::get (
idiststream& ips,
const geo_rep<T,distributed>& omega)
{
return base::data().template get (ips, omega);
}
template<class T>
inline
odiststream&
domain_indirect_basic<distributed>::put (
odiststream& ops,
const geo_rep<T,distributed>& omega) const
{
return base::data().template put (ops, omega);
}
inline
std::string
domain_indirect_basic<distributed>::name() const
{
return base::data().name();
}
inline
domain_indirect_basic<distributed>::size_type
domain_indirect_basic<distributed>::map_dimension() const
{
return base::data().map_dimension();
}
inline
void
domain_indirect_basic<distributed>::set_name(std::string name)
{
return base::data().set_name (name);
}
inline
void
domain_indirect_basic<distributed>::set_map_dimension (size_type map_dim)
{
return base::data().set_map_dimension (map_dim);
}
inline
const geo_element_indirect&
domain_indirect_basic<distributed>::oige (size_type ioige) const
{
return base::data().oige (ioige);
}
inline
domain_indirect_basic<distributed>::const_iterator_ioige
domain_indirect_basic<distributed>::ioige_begin() const
{
return base::data().ioige_begin();
}
inline
domain_indirect_basic<distributed>::const_iterator_ioige
domain_indirect_basic<distributed>::ioige_end() const
{
return base::data().ioige_end();
}
inline
domain_indirect_basic<distributed>::iterator_ioige
domain_indirect_basic<distributed>::ioige_begin()
{
return base::data().ioige_begin();
}
inline
domain_indirect_basic<distributed>::iterator_ioige
domain_indirect_basic<distributed>::ioige_end()
{
return base::data().ioige_end();
}
inline
const distributor&
domain_indirect_basic<distributed>::ini_ownership() const
{
return base::data().ini_ownership();
}
inline
domain_indirect_basic<distributed>::size_type
domain_indirect_basic<distributed>::ioige2ini_dis_ioige (size_type ioige) const
{
return base::data().ioige2ini_dis_ioige (ioige);
}
inline
domain_indirect_basic<distributed>::size_type
domain_indirect_basic<distributed>::ini_ioige2dis_ioige (size_type ini_ioige) const
{
return base::data().ini_ioige2dis_ioige (ini_ioige);
}
// union:
template<class T>
inline
domain_indirect_basic<distributed>
build_union (
const geo_basic<T,distributed>& omega,
const domain_indirect_basic<distributed>& a,
const domain_indirect_basic<distributed>& b)
{
domain_indirect_basic<distributed> c;
c.data().build_union (omega, a.data(), b.data());
return c;
}
#endif // _RHEOLEF_HAVE_MPI
} // namespace rheolef
#endif // _RHEOLEF_DOMAIN_MASK_H
|