Dune Core Modules (2.6.0)

gridptr.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3#ifndef DUNE_DGF_GRIDPTR_HH
4#define DUNE_DGF_GRIDPTR_HH
5
6#include <cassert>
7
8#include <array>
9#include <iostream>
10#include <map>
11#include <memory>
12#include <string>
13#include <type_traits>
14#include <vector>
15
16//- Dune includes
19
20#include <dune/grid/common/gridenums.hh>
22#include <dune/grid/common/intersection.hh>
23#include <dune/grid/common/partitionset.hh>
24#include <dune/grid/common/rangegenerators.hh>
25
26#include <dune/grid/io/file/dgfparser/dgfexception.hh>
27#include <dune/grid/io/file/dgfparser/entitykey.hh>
28#include <dune/grid/io/file/dgfparser/parser.hh>
29
30namespace Dune
31{
32
33 // External Forward Declarations
34 // -----------------------------
35
36 template < class G >
37 struct DGFGridFactory;
38
39 template< class GridImp, class IntersectionImp >
40 class Intersection;
41
42
43
44 // GridPtr
45 // -------
46
59 template< class GridType >
60 struct GridPtr
61 {
62 class mygrid_ptr : public std::shared_ptr< GridType >
63 {
64 typedef std::shared_ptr< GridType > base_t ;
65 // empty deleter to avoid deletion on release
66 typedef null_deleter< GridType > emptydeleter_t ;
67
68 void removeObj()
69 {
70 // if use count is only 1 delete object
71 if( use_count() == 1 )
72 {
73 // delete point here, since we use the empty deleter
74 GridType* grd = release();
75 if( grd ) delete grd ;
76 }
77 }
78
79 void assignObj( const mygrid_ptr& other )
80 {
81 removeObj();
82 base_t :: operator = ( other );
83 }
84 public:
85 using base_t :: get ;
86 using base_t :: swap ;
87 using base_t :: use_count ;
88
89 // default constructor
90 mygrid_ptr() : base_t( ( GridType * ) 0, emptydeleter_t() ) {}
91 // copy constructor
92 mygrid_ptr( const mygrid_ptr& other ) { assignObj( other ); }
93 // constructor taking pointer
94 explicit mygrid_ptr( GridType* grd ) : base_t( grd, emptydeleter_t() ) {}
95
96 // destructor
97 ~mygrid_ptr() { removeObj(); }
98
99 // assigment operator
100 mygrid_ptr& operator = ( const mygrid_ptr& other )
101 {
102 assignObj( other );
103 return *this;
104 }
105
106 // release pointer
107 GridType* release()
108 {
109 GridType* grd = this->get();
110 base_t ptr(( GridType * ) 0, emptydeleter_t() );
111 this->swap( ptr );
112 return grd ;
113 }
114 };
115
116 typedef MPIHelper::MPICommunicator MPICommunicatorType;
117 static const int dimension = GridType::dimension;
118
120 explicit GridPtr ( const std::string &filename,
121 MPICommunicatorType comm = MPIHelper::getCommunicator() )
122 : gridPtr_(),
123 elParam_(),
124 vtxParam_(),
125 bndParam_(),
126 bndId_(),
127 emptyParam_(),
128 nofElParam_( 0 ),
129 nofVtxParam_( 0 ),
130 haveBndParam_( false )
131 {
132 DGFGridFactory< GridType > dgfFactory( filename, comm );
133 initialize( dgfFactory );
134 }
135
137 explicit GridPtr ( std::istream &input,
138 MPICommunicatorType comm = MPIHelper::getCommunicator() )
139 : gridPtr_(),
140 elParam_(),
141 vtxParam_(),
142 bndParam_(),
143 bndId_(),
144 emptyParam_(),
145 nofElParam_( 0 ),
146 nofVtxParam_( 0 ),
147 haveBndParam_( false )
148 {
149 DGFGridFactory< GridType > dgfFactory( input, comm );
150 initialize( dgfFactory );
151 }
152
155 : gridPtr_(),
156 elParam_(),
157 vtxParam_(),
158 bndParam_(),
159 bndId_(),
160 emptyParam_(),
161 nofElParam_(0),
162 nofVtxParam_(0),
163 haveBndParam_( false )
164 {}
165
167 explicit GridPtr( GridType *grd )
168 : gridPtr_(grd),
169 elParam_(),
170 vtxParam_(),
171 bndParam_(),
172 bndId_(),
173 emptyParam_(),
174 nofElParam_(0),
175 nofVtxParam_(0),
176 haveBndParam_( false )
177 {}
178
180 GridPtr( const GridPtr &org )
181 : gridPtr_(org.gridPtr_),
182 elParam_(org.elParam_),
183 vtxParam_(org.vtxParam_),
184 bndParam_(org.bndParam_),
185 bndId_(org.bndId_),
186 emptyParam_( org.emptyParam_ ),
187 nofElParam_(org.nofElParam_),
188 nofVtxParam_(org.nofVtxParam_),
189 haveBndParam_(org.haveBndParam_)
190 {}
191
194 {
195 gridPtr_ = org.gridPtr_;
196 elParam_ = org.elParam_;
197 vtxParam_ = org.vtxParam_;
198 bndParam_ = org.bndParam_;
199 bndId_ = org.bndId_;
200 emptyParam_ = org.emptyParam_;
201
202 nofElParam_ = org.nofElParam_;
203 nofVtxParam_ = org.nofVtxParam_;
204 haveBndParam_ = org.haveBndParam_;
205 return *this;
206 }
207
209 GridPtr& operator = (GridType * grd)
210 {
211 gridPtr_ = mygrid_ptr( grd );
212 elParam_.resize(0);
213 vtxParam_.resize(0);
214 bndParam_.resize(0);
215 bndId_.resize(0);
216 emptyParam_.resize(0);
217
218 nofVtxParam_ = 0;
219 nofElParam_ = 0;
220 haveBndParam_ = false;
221 return *this;
222 }
223
225 GridType& operator*() {
226 return *gridPtr_;
227 }
228
230 GridType* operator->() {
231 return gridPtr_.operator -> ();
232 }
233
235 const GridType& operator*() const {
236 return *gridPtr_;
237 }
238
240 const GridType* operator->() const {
241 return gridPtr_.operator -> ();
242 }
243
245 GridType* release () { return gridPtr_.release(); }
246
248 int nofParameters(int cdim) const {
249 switch (cdim) {
250 case 0 : return nofElParam_; break;
251 case GridType::dimension : return nofVtxParam_; break;
252 }
253 return 0;
254 }
255
257 template <class Entity>
258 int nofParameters ( const Entity & ) const
259 {
260 return nofParameters( (int) Entity::codimension );
261 }
262
264 template< class GridImp, class IntersectionImp >
266 {
267 return parameters( intersection ).size();
268 }
269
271 template <class Entity>
272 const std::vector< double > &parameters ( const Entity &entity ) const
273 {
274 typedef typename GridType::LevelGridView GridView;
275 GridView gridView = gridPtr_->levelGridView( 0 );
276 switch( (int)Entity::codimension )
277 {
278 case 0 :
279 if( nofElParam_ > 0 )
280 {
281 assert( (unsigned int)gridView.indexSet().index( entity ) < elParam_.size() );
282 return elParam_[ gridView.indexSet().index( entity ) ];
283 }
284 break;
285 case GridType::dimension :
286 if( nofVtxParam_ > 0 )
287 {
288 assert( (unsigned int)gridView.indexSet().index( entity ) < vtxParam_.size() );
289 return vtxParam_[ gridView.indexSet().index( entity ) ];
290 }
291 break;
292 }
293 return emptyParam_;
294 }
295
297 template< class GridImp, class IntersectionImp >
299 {
300 // if no parameters given return empty vector
301 if ( !haveBndParam_ )
303
304 return bndParam_[ intersection.boundarySegmentIndex() ];
305 }
306
307 void communicate ()
308 {
309 if( gridPtr_->comm().size() > 1 )
310 {
311 DataHandle dh(*this);
312 gridPtr_->levelGridView( 0 ).communicate( dh.interface(), InteriorBorder_All_Interface,ForwardCommunication );
313 }
314 }
315
316 void loadBalance ()
317 {
318 if( gridPtr_->comm().size() > 1 )
319 {
320 DataHandle dh(*this);
321 gridPtr_->loadBalance( dh.interface() );
322 gridPtr_->levelGridView( 0 ).communicate( dh.interface(), InteriorBorder_All_Interface,ForwardCommunication );
323 }
324 }
325
326 protected:
327 template< class Range >
328 static bool isEmpty ( Range &&range )
329 {
330 return range.begin() == range.end();
331 }
332
333 void initialize ( DGFGridFactory< GridType > &dgfFactory )
334 {
335 gridPtr_ = mygrid_ptr( dgfFactory.grid() );
336
337 const auto gridView = gridPtr_->levelGridView( 0 );
338 const auto &indexSet = gridView.indexSet();
339
340 nofElParam_ = dgfFactory.template numParameters< 0 >();
341 nofVtxParam_ = dgfFactory.template numParameters< dimension >();
342 haveBndParam_ = dgfFactory.haveBoundaryParameters();
343
344 std::array< int, 3 > nofParams = {{ nofElParam_, nofVtxParam_, static_cast< int >( haveBndParam_ ) }};
345 gridView.comm().max( nofParams.data(), nofParams.size() );
346
347 // empty grids have no parameters associated
348 if( isEmpty( elements( gridView, Partitions::interiorBorder ) ) )
349 {
350 nofElParam_ = nofParams[ 0 ];
351 nofVtxParam_ = nofParams[ 1 ];
352 }
353
354 // boundary parameters may be empty
355 haveBndParam_ = static_cast< bool >( nofParams[ 2 ] );
356
357 if( (nofElParam_ != nofParams[ 0 ]) || (nofVtxParam_ != nofParams[ 1 ]) )
358 DUNE_THROW( DGFException, "Number of parameters differs between processes" );
359
360 elParam_.resize( nofElParam_ > 0 ? indexSet.size( 0 ) : 0 );
361 vtxParam_.resize( nofVtxParam_ > 0 ? indexSet.size( dimension ) : 0 );
362
363 bndId_.resize( indexSet.size( 1 ) );
364 if( haveBndParam_ )
365 bndParam_.resize( gridPtr_->numBoundarySegments() );
366
367 for( const auto &element : elements( gridView, Partitions::interiorBorder ) )
368 {
369 if( nofElParam_ > 0 )
370 {
371 std::swap( elParam_[ indexSet.index( element ) ], dgfFactory.parameter( element ) );
372 assert( elParam_[ indexSet.index( element ) ].size() == static_cast< std::size_t >( nofElParam_ ) );
373 }
374
375 if( nofVtxParam_ > 0 )
376 {
377 for( unsigned int v = 0, n = element.subEntities( dimension ); v < n; ++v )
378 {
379 const auto index = indexSet.subIndex( element, v, dimension );
380 if( vtxParam_[ index ].empty() )
381 std::swap( vtxParam_[ index ], dgfFactory.parameter( element.template subEntity< dimension >( v ) ) );
382 assert( vtxParam_[ index ].size() == static_cast< std::size_t >( nofVtxParam_ ) );
383 }
384 }
385
386 if( element.hasBoundaryIntersections() )
387 {
388 for( const auto &intersection : intersections( gridView, element ) )
389 {
390 // dirty hack: check for "none" to make corner point grid work
391 if( !intersection.boundary() || intersection.type().isNone() )
392 continue;
393
394 const auto k = indexSet.subIndex( element, intersection.indexInInside(), 1 );
395 bndId_[ k ] = dgfFactory.boundaryId( intersection );
396 if( haveBndParam_ )
397 bndParam_[ intersection.boundarySegmentIndex() ] = dgfFactory.boundaryParameter( intersection );
398 }
399 }
400 }
401 }
402
403 template <class Entity>
404 std::vector< double > &params ( const Entity &entity )
405 {
406 const auto gridView = gridPtr_->levelGridView( 0 );
407 switch( (int)Entity::codimension )
408 {
409 case 0 :
410 if( nofElParam_ > 0 ) {
411 if ( gridView.indexSet().index( entity ) >= elParam_.size() )
412 elParam_.resize( gridView.indexSet().index( entity ) );
413 return elParam_[ gridView.indexSet().index( entity ) ];
414 }
415 break;
416 case GridType::dimension :
417 if( nofVtxParam_ > 0 ) {
418 if ( gridView.indexSet().index( entity ) >= vtxParam_.size() )
419 vtxParam_.resize( gridView.indexSet().index( entity ) );
420 return vtxParam_[ gridView.indexSet().index( entity ) ];
421 }
422 break;
423 }
424 return emptyParam_;
425 }
426
427 void setNofParams( int cdim, int nofP )
428 {
429 switch (cdim) {
430 case 0 : nofElParam_ = nofP; break;
431 case GridType::dimension : nofVtxParam_ = nofP; break;
432 }
433 }
434
435 struct DataHandle
436 : public CommDataHandleIF< DataHandle, char >
437 {
438 explicit DataHandle ( GridPtr &gridPtr )
439 : gridPtr_( gridPtr ), idSet_( gridPtr->localIdSet() )
440 {
441 const auto gridView = gridPtr_->levelGridView( 0 );
442 const auto &indexSet = gridView.indexSet();
443
444 for( const auto &element : elements( gridView, Partitions::interiorBorder ) )
445 {
446 if( gridPtr_.nofElParam_ > 0 )
447 std::swap( gridPtr_.elParam_[ indexSet.index( element ) ], elData_[ idSet_.id( element ) ] );
448
449 if( gridPtr_.nofVtxParam_ > 0 )
450 {
451 for( unsigned int v = 0, n = element.subEntities( dimension ); v < n; ++v )
452 {
453 const auto index = indexSet.subIndex( element, v, dimension );
454 if ( !gridPtr_.vtxParam_[ index ].empty() )
455 std::swap( gridPtr_.vtxParam_[ index ], vtxData_[ idSet_.subId( element, v, dimension ) ] );
456 }
457 }
458
459 if( element.hasBoundaryIntersections() )
460 {
461 for( const auto &intersection : intersections( gridView, element ) )
462 {
463 // dirty hack: check for "none" to make corner point grid work
464 if( !intersection.boundary() || intersection.type().isNone() )
465 continue;
466
467 const int i = intersection.indexInInside();
468 auto &bndData = bndData_[ idSet_.subId( element, i, 1 ) ];
469 bndData.first = gridPtr_.bndId_[ indexSet.subIndex( element, i, 1 ) ];
470 if( gridPtr_.haveBndParam_ )
471 std::swap( bndData.second, gridPtr_.bndParam_[ intersection.boundarySegmentIndex() ] );
472 }
473 }
474 }
475 }
476
477 DataHandle ( const DataHandle & ) = delete;
478 DataHandle ( DataHandle && ) = delete;
479
480 ~DataHandle ()
481 {
482 const auto gridView = gridPtr_->levelGridView( 0 );
483 const auto &indexSet = gridView.indexSet();
484
485 if( gridPtr_.nofElParam_ > 0 )
486 gridPtr_.elParam_.resize( indexSet.size( 0 ) );
487 if( gridPtr_.nofVtxParam_ > 0 )
488 gridPtr_.vtxParam_.resize( indexSet.size( dimension ) );
489
490 for( const auto &element : elements( gridView, Partitions::all ) )
491 {
492 if( gridPtr_.nofElParam_ > 0 )
493 {
494 std::swap( gridPtr_.elParam_[ indexSet.index( element ) ], elData_[ idSet_.id( element ) ] );
495 assert( gridPtr_.elParam_[ indexSet.index( element ) ].size() == static_cast< std::size_t >( gridPtr_.nofElParam_ ) );
496 }
497
498 if( gridPtr_.nofVtxParam_ > 0 )
499 {
500 for( unsigned int v = 0; v < element.subEntities( dimension ); ++v )
501 {
502 const auto index = indexSet.subIndex( element, v, dimension );
503 if( gridPtr_.vtxParam_[ index ].empty() )
504 std::swap( gridPtr_.vtxParam_[ index ], vtxData_[ idSet_.subId( element, v, dimension ) ] );
505 assert( gridPtr_.vtxParam_[ index ].size() == static_cast< std::size_t >( gridPtr_.nofVtxParam_ ) );
506 }
507 }
508
509 if( element.hasBoundaryIntersections() )
510 {
511 for( const auto &intersection : intersections( gridView, element ) )
512 {
513 // dirty hack: check for "none" to make corner point grid work
514 if( !intersection.boundary() || intersection.type().isNone() )
515 continue;
516
517 const int i = intersection.indexInInside();
518 auto &bndData = bndData_[ idSet_.subId( element, i, 1 ) ];
519 gridPtr_.bndId_[ indexSet.subIndex( element, i, 1 ) ] = bndData.first;
520 if( gridPtr_.haveBndParam_ )
521 std::swap( bndData.second, gridPtr_.bndParam_[ intersection.boundarySegmentIndex() ] );
522 }
523 }
524 }
525 }
526
527 CommDataHandleIF< DataHandle, char > &interface () { return *this; }
528
529 bool contains ( int dim, int codim ) const
530 {
531 assert( dim == dimension );
532 // do not use a switch statement, because dimension == 1 is possible
533 return (codim == 1) || ((codim == dimension) && (gridPtr_.nofVtxParam_ > 0)) || ((codim == 0) && (gridPtr_.nofElParam_ > 0));
534 }
535
536 bool fixedSize (int dim, int codim) const { return false; }
537
538 template< class Entity >
539 std::size_t size ( const Entity &entity ) const
540 {
541 std::size_t size = 0;
542
543 // do not use a switch statement, because dimension == 1 is possible
544 if( (Entity::codimension == 0) && (gridPtr_.nofElParam_ > 0) )
545 {
546 assert( elData_[ idSet_.id( entity ) ].size() == static_cast< std::size_t >( gridPtr_.nofElParam_ ) );
547 for( double &v : elData_[ idSet_.id( entity ) ] )
548 size += dataSize( v );
549 }
550
551 if( (Entity::codimension == dimension) && (gridPtr_.nofVtxParam_ > 0) )
552 {
553 assert( vtxData_[ idSet_.id( entity ) ].size() == static_cast< std::size_t >( gridPtr_.nofVtxParam_ ) );
554 for( double &v : vtxData_[ idSet_.id( entity ) ] )
555 size += dataSize( v );
556 }
557
558 if( Entity::codimension == 1 )
559 {
560 const auto bndData = bndData_.find( idSet_.id( entity ) );
561 if( bndData != bndData_.end() )
562 size += dataSize( bndData->second.first ) + dataSize( bndData->second.second );
563 }
564
565 return size;
566 }
567
568 template< class Buffer, class Entity >
569 void gather ( Buffer &buffer, const Entity &entity ) const
570 {
571 // do not use a switch statement, because dimension == 1 is possible
572 if( (Entity::codimension == 0) && (gridPtr_.nofElParam_ > 0) )
573 {
574 assert( elData_[ idSet_.id( entity ) ].size() == static_cast< std::size_t >( gridPtr_.nofElParam_ ) );
575 for( double &v : elData_[ idSet_.id( entity ) ] )
576 write( buffer, v );
577 }
578
579 if( (Entity::codimension == dimension) && (gridPtr_.nofVtxParam_ > 0) )
580 {
581 assert( vtxData_[ idSet_.id( entity ) ].size() == static_cast< std::size_t >( gridPtr_.nofVtxParam_ ) );
582 for( double &v : vtxData_[ idSet_.id( entity ) ] )
583 write( buffer, v );
584 }
585
586 if( Entity::codimension == 1 )
587 {
588 const auto bndData = bndData_.find( idSet_.id( entity ) );
589 if( bndData != bndData_.end() )
590 {
591 write( buffer, bndData->second.first );
592 write( buffer, bndData->second.second );
593 }
594 }
595 }
596
597 template< class Buffer, class Entity >
598 void scatter ( Buffer &buffer, const Entity &entity, std::size_t n )
599 {
600 // do not use a switch statement, because dimension == 1 is possible
601 if( (Entity::codimension == 0) && (gridPtr_.nofElParam_ > 0) )
602 {
603 auto &p = elData_[ idSet_.id( entity ) ];
604 p.resize( gridPtr_.nofElParam_ );
605 for( double &v : p )
606 read( buffer, v, n );
607 }
608
609 if( (Entity::codimension == dimension) && (gridPtr_.nofVtxParam_ > 0) )
610 {
611 auto &p = vtxData_[ idSet_.id( entity ) ];
612 p.resize( gridPtr_.nofVtxParam_ );
613 for( double &v : p )
614 read( buffer, v, n );
615 }
616
617 if( (Entity::codimension == 1) && (n > 0) )
618 {
619 auto &bndData = bndData_[ idSet_.id( entity ) ];
620 read( buffer, bndData.first, n );
621 read( buffer, bndData.second, n );
622 }
623
624 assert( n == 0 );
625 }
626
627 private:
628 template< class T >
629 static std::enable_if_t< std::is_trivially_copyable< T >::value, std::size_t > dataSize ( const T &value )
630 {
631 return sizeof( T );
632 }
633
634 static std::size_t dataSize ( const std::string &s )
635 {
636 return dataSize( s.size() ) + s.size();
637 }
638
639 template< class Buffer, class T >
640 static std::enable_if_t< std::is_trivially_copyable< T >::value > write ( Buffer &buffer, const T &value )
641 {
642 std::array< char, sizeof( T ) > bytes;
643 std::memcpy( bytes.data(), &value, sizeof( T ) );
644 for( char &b : bytes )
645 buffer.write( b );
646 }
647
648 template< class Buffer >
649 static void write ( Buffer &buffer, const std::string &s )
650 {
651 write( buffer, s.size() );
652 for( const char &c : s )
653 buffer.write( c );
654 }
655
656 template< class Buffer, class T >
657 static std::enable_if_t< std::is_trivially_copyable< T >::value > read ( Buffer &buffer, T &value, std::size_t &n )
658 {
659 assert( n >= sizeof( T ) );
660 n -= sizeof( T );
661
662 std::array< char, sizeof( T ) > bytes;
663 for( char &b : bytes )
664 buffer.read( b );
665 std::memcpy( &value, bytes.data(), sizeof( T ) );
666 }
667
668 template< class Buffer >
669 static void read ( Buffer &buffer, std::string &s, std::size_t &n )
670 {
671 std::size_t size;
672 read( buffer, size, n );
673 s.resize( size );
674
675 assert( n >= size );
676 n -= size;
677
678 for( char &c : s )
679 buffer.read( c );
680 }
681
682 GridPtr &gridPtr_;
683 const typename GridType::LocalIdSet &idSet_;
684 mutable std::map< typename GridType::LocalIdSet::IdType, std::vector< double > > elData_, vtxData_;
685 mutable std::map< typename GridType::LocalIdSet::IdType, std::pair< int, DGFBoundaryParameter::type > > bndData_;
686 };
687
688 // grid auto pointer
689 mutable mygrid_ptr gridPtr_;
690 // element and vertex parameters
691 std::vector< std::vector< double > > elParam_;
692 std::vector< std::vector< double > > vtxParam_;
693 std::vector< DGFBoundaryParameter::type > bndParam_;
694 std::vector< int > bndId_;
695 std::vector< double > emptyParam_;
696
697 int nofElParam_;
698 int nofVtxParam_;
699 bool haveBndParam_;
700 }; // end of class GridPtr
701
702} // end namespace Dune
703
704#endif
void scatter(MessageBufferImp &buff, const EntityType &e, size_t n)
unpack data from message buffer to user.
Definition: datahandleif.hh:167
size_t size(const EntityType &e) const
how many objects of type DataType have to be sent for a given entity
Definition: datahandleif.hh:142
void gather(MessageBufferImp &buff, const EntityType &e) const
pack data from user to message buffer
Definition: datahandleif.hh:153
Wrapper class for entities.
Definition: entity.hh:64
@ codimension
Know your own codimension.
Definition: entity.hh:105
Grid view abstract base class.
Definition: gridview.hh:60
Intersection of a mesh entity of codimension 0 ("element") with a "neighboring" element or with the d...
Definition: intersection.hh:162
size_t boundarySegmentIndex() const
index of the boundary segment within the macro grid
Definition: intersection.hh:246
MPI_Comm MPICommunicator
The type of the mpi communicator.
Definition: mpihelper.hh:178
static MPICommunicator getCommunicator()
get the default communicator
Definition: mpihelper.hh:186
Describes the parallel communication interface class for MessageBuffers and DataHandles.
#define DUNE_THROW(E, m)
Definition: exceptions.hh:216
const IndexSet & indexSet() const
obtain the index set
Definition: gridview.hh:172
@ ForwardCommunication
communicate as given in InterfaceType
Definition: gridenums.hh:169
@ InteriorBorder_All_Interface
send interior and border, receive all entities
Definition: gridenums.hh:86
Helpers for dealing with MPI.
constexpr All all
PartitionSet for all partitions.
Definition: partitionset.hh:294
constexpr InteriorBorder interiorBorder
PartitionSet for the interior and border partitions.
Definition: partitionset.hh:285
Dune namespace.
Definition: alignedallocator.hh:10
This file implements the class shared_ptr (a reference counting pointer), for those systems that don'...
static const type & defaultValue()
default constructor
Definition: parser.hh:26
std::string type
type of additional boundary parameters
Definition: parser.hh:23
Class for constructing grids from DGF files.
Definition: gridptr.hh:61
GridPtr(std::istream &input, MPICommunicatorType comm=MPIHelper::getCommunicator())
constructor given a std::istream
Definition: gridptr.hh:137
const std::vector< double > & parameters(const Entity &entity) const
get parameters defined for each codim 0 und dim entity on the grid through the grid file
Definition: gridptr.hh:272
GridPtr(const GridPtr &org)
Copy constructor, copies internal auto pointer.
Definition: gridptr.hh:180
GridPtr()
Default constructor, creating empty GridPtr.
Definition: gridptr.hh:154
const GridType & operator*() const
return const reference to GridType instance
Definition: gridptr.hh:235
GridPtr(GridType *grd)
Constructor storing given pointer to internal auto pointer.
Definition: gridptr.hh:167
const DGFBoundaryParameter::type & parameters(const Intersection< GridImp, IntersectionImp > &intersection) const
get parameters for intersection
Definition: gridptr.hh:298
GridType & operator*()
return reference to GridType instance
Definition: gridptr.hh:225
int nofParameters(const Entity &) const
get parameters defined for given entity
Definition: gridptr.hh:258
GridPtr(const std::string &filename, MPICommunicatorType comm=MPIHelper::getCommunicator())
constructor given the name of a DGF file
Definition: gridptr.hh:120
GridPtr & operator=(const GridPtr &org)
assignment of grid pointer
Definition: gridptr.hh:193
int nofParameters(int cdim) const
get number of parameters defined for a given codimension
Definition: gridptr.hh:248
int nofParameters(const Intersection< GridImp, IntersectionImp > &intersection) const
get number of parameters defined for a given intersection
Definition: gridptr.hh:265
const GridType * operator->() const
return const pointer to GridType instance
Definition: gridptr.hh:240
GridType * release()
release pointer from internal ownership
Definition: gridptr.hh:245
GridType * operator->()
return pointer to GridType instance
Definition: gridptr.hh:230
implements the Deleter concept of shared_ptr without deleting anything
Definition: shared_ptr.hh:52
std::size_t fixedSize
The number of data items per index if it is fixed, 0 otherwise.
Definition: variablesizecommunicator.hh:245
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Dec 26, 23:30, 2024)