Sierra Toolkit  Version of the Day
MetaData.hpp
1 /*------------------------------------------------------------------------*/
2 /* Copyright 2010, 2011 Sandia Corporation. */
3 /* Under terms of Contract DE-AC04-94AL85000, there is a non-exclusive */
4 /* license for use of this work by or on behalf of the U.S. Government. */
5 /* Export of this program may require a license from the */
6 /* United States Government. */
7 /*------------------------------------------------------------------------*/
8 
9 #ifndef stk_mesh_MetaData_hpp
10 #define stk_mesh_MetaData_hpp
11 
12 //----------------------------------------------------------------------
13 
14 #include <iosfwd>
15 
16 #include <stk_util/util/SameType.hpp>
17 #include <stk_util/util/StaticAssert.hpp>
18 #include <stk_util/parallel/Parallel.hpp>
19 
20 #include <stk_mesh/base/Types.hpp>
21 #include <stk_mesh/base/Part.hpp>
22 #include <stk_mesh/base/Field.hpp>
23 #include <stk_mesh/base/PropertyBase.hpp>
24 #include <stk_mesh/base/EntityKey.hpp>
25 #include <stk_mesh/base/Selector.hpp>
26 
27 #include <stk_mesh/baseImpl/PartRepository.hpp>
28 #include <stk_mesh/baseImpl/FieldBaseImpl.hpp>
29 #include <stk_mesh/baseImpl/FieldRepository.hpp>
30 
31 namespace stk_classic {
32 namespace mesh {
33 
34 namespace fem {
35 class FEMMetaData;
36 }
37 
43 std::ostream &
44 print_entity_key( std::ostream & os, const MetaData & meta_data, const EntityKey & key);
45 
46 std::string
47 print_entity_key( const MetaData & meta_data, const EntityKey & key );
48 
49 //----------------------------------------------------------------------
56 class MetaData {
57 public:
58 
60  //------------------------------------
65  inline static MetaData & get( const Part & part ) { return part.meta_data(); }
66  inline static MetaData & get( const FieldBase & field ) { return field.meta_data(); }
67  inline static MetaData & get( const PropertyBase & property ) { return property.meta_data(); }
68 
69  static MetaData & get( const BulkData & bulk_data );
70  static MetaData & get( const Bucket & bucket );
71  static MetaData & get( const Entity & entity );
72  static MetaData & get( const Ghosting & ghost );
73 
75  explicit MetaData( const std::vector<std::string>& entity_rank_names );
76 
78  MetaData();
79 
80  //------------------------------------
88  Part & universal_part() const { return *m_universal_part; }
89 
93  Part & locally_owned_part() const { return *m_owns_part ; }
94 
98  Part & globally_shared_part() const { return *m_shares_part ; }
99 
101  //------------------------------------
112  Part * get_part( const std::string & p_name,
114  const char * required_by = NULL ) const ;
115 
117  Part & get_part( unsigned ord ) const ;
118 
120  const PartVector & get_parts() const { return m_part_repo.get_all_parts(); }
121 
129  Part & declare_part( const std::string & p_name, EntityRank rank );
130 
136  Part & declare_part( const std::string & p_name);
137 
145  Part & declare_part( const PartVector & p_name);
146 
148  void declare_part_subset( Part & superset , Part & subset );
149 
159  void declare_part_relation( Part & root_part ,
160  relation_stencil_ptr stencil ,
161  Part & target_part );
162 
169  template<class T>
170  const T * declare_attribute_with_delete( Part & part, const T * attribute);
171  template<class T>
172  const T * declare_attribute_no_delete( Part & part, const T * attribute);
173  template<class T>
174  bool remove_attribute( Part & part, const T * attribute);
175 
177  //------------------------------------
184  void set_entity_rank_names(const std::vector<std::string> &entity_rank_names);
185 
186  EntityRank entity_rank( const std::string &name ) const;
187 
188  const std::vector<std::string> & entity_rank_names() const
189  { return m_entity_rank_names ; }
190 
191  std::vector<std::string>::size_type entity_rank_count() const
192  { return m_entity_rank_names.size(); }
193 
194  const std::string & entity_rank_name( EntityRank entity_rank ) const ;
195 
199  bool check_rank(EntityRank rank) const;
200 
202  //------------------------------------
214  template< class field_type >
215  field_type * get_field( const std::string & name ) const ;
216 
218  const FieldVector & get_fields() const {
219  return m_field_repo.get_fields() ;
220  }
221 
231  template< class field_type >
232  field_type & declare_field( const std::string & name ,
233  unsigned number_of_states = 1 );
234 
240  template<class T>
241  const T * declare_attribute_with_delete( FieldBase & field, const T * attribute);
242  template<class T>
243  const T * declare_attribute_no_delete( FieldBase & field, const T * attribute);
244 
264  template< class PointerFieldType , class ReferencedFieldType >
265  void declare_field_relation( PointerFieldType & pointer_field ,
266  relation_stencil_ptr stencil ,
267  ReferencedFieldType & referenced_field );
268 
270  const std::vector<FieldRelation> & get_field_relations() const
271  { return m_field_relations ; }
272 
274  //------------------------------------
275 
276  template<class T>
277  const T * get_attribute() const ;
278 
283  template<class T>
284  const T * declare_attribute_with_delete( const T * attribute);
285 
286  template<class T>
287  const T * declare_attribute_no_delete( const T * attribute);
288 
289  template<class T>
290  bool remove_attribute( const T * );
291 
292  //------------------------------------
304  template< typename DataType >
305  Property<DataType> * get_property( const std::string & name ) const ;
306 
308  const std::vector< PropertyBase * > & get_properties() const
309  { return m_properties ; }
310 
317  template< typename DataType >
318  Property<DataType> & declare_property( const std::string & name ,
319  unsigned size = 1 );
320 
322  void put_property( PropertyBase & property, Part & part);
323 
325  unsigned get_spatial_dimension() const { return m_spatial_dimension; }
326 
335  void commit();
336 
338  bool is_commit() const { return m_commit ; }
339 
343  ~MetaData();
344 
346  //------------------------------------
347 
355  const std::string & arg_name,
356  const DataTraits & arg_traits ,
357  unsigned arg_rank ,
358  const shards::ArrayDimTag * const * arg_dim_tags ,
359  unsigned arg_num_states );
360 
363  void declare_field_restriction( FieldBase & arg_field ,
364  EntityRank arg_entity_rank ,
365  const Part & arg_part ,
366  const unsigned * arg_stride ,
367  const void* arg_init_value = NULL );
368 
371  void declare_field_restriction( FieldBase & arg_field ,
372  EntityRank arg_entity_rank ,
373  const Selector & arg_selector ,
374  const unsigned * arg_stride ,
375  const void* arg_init_value = NULL );
377 private:
378  MetaData( const MetaData & );
379  MetaData & operator = ( const MetaData & );
380 
381  Part & declare_internal_part( const std::string & p_name);
382 
383  Part & declare_internal_part( const std::string & p_name, EntityRank rank);
384 
385  bool m_commit ;
386  impl::PartRepository m_part_repo ;
387  CSet m_attributes ;
388 
389  Part * m_universal_part ;
390  Part * m_owns_part ;
391  Part * m_shares_part ;
392 
393 
394  impl::FieldRepository m_field_repo ;
395 
396  std::vector< FieldRelation > m_field_relations ;
397  std::vector< PropertyBase* > m_properties ;
398  std::vector< std::string > m_entity_rank_names ;
399 
400  unsigned m_spatial_dimension;
401  friend class fem::FEMMetaData;
402 
406  void require_committed() const ;
407 
408  void require_not_committed() const ;
409 
410  void require_same_mesh_meta_data( const MetaData & rhs ) const ;
411 
412  void require_valid_entity_rank( EntityRank rank) const ;
413 
414  void require_not_relation_target( const Part * const part ) const ;
416  //------------------------------------
417 
418  Property<void> * get_property_base( const std::string & ,
419  const std::type_info & ,
420  unsigned = 0 ) const ;
421 
422  void internal_declare_field_relation( FieldBase & ,
424  FieldBase & );
425 
426  void clean_field_restrictions();
427 };
428 
430 void verify_parallel_consistency( const MetaData & , ParallelMachine );
431 
440 template< class field_type >
441 field_type & put_field( field_type & field ,
442  EntityRank entity_rank ,
443  const Part & part ,
444  const void* init_value = NULL);
445 
446 template< class field_type >
447 field_type & put_field( field_type & field ,
448  EntityRank entity_rank ,
449  const Selector & selector ,
450  const void* init_value = NULL);
451 
457 template< class field_type >
458 field_type & put_field( field_type & field ,
459  EntityRank entity_rank ,
460  const Part & part ,
461  unsigned n1 ,
462  const void* init_value = NULL);
463 
464 template< class field_type >
465 field_type & put_field( field_type & field ,
466  EntityRank entity_rank ,
467  const Selector & selector ,
468  unsigned n1 ,
469  const void* init_value = NULL);
470 
471 template< class field_type >
472 field_type & put_field( field_type & field ,
473  EntityRank entity_rank ,
474  const Part & part ,
475  unsigned n1 ,
476  unsigned n2 ,
477  const void* init_value = NULL);
478 
479 template< class field_type >
480 field_type & put_field( field_type & field ,
481  EntityRank entity_rank ,
482  const Selector & selector ,
483  unsigned n1 ,
484  unsigned n2 ,
485  const void* init_value = NULL);
486 
487 template< class field_type >
488 field_type & put_field( field_type & field ,
489  EntityRank entity_rank ,
490  const Part & part ,
491  unsigned n1 ,
492  unsigned n2 ,
493  unsigned n3 ,
494  const void* init_value = NULL);
495 
496 template< class field_type >
497 field_type & put_field( field_type & field ,
498  EntityRank entity_rank ,
499  const Selector & selector ,
500  unsigned n1 ,
501  unsigned n2 ,
502  unsigned n3 ,
503  const void* init_value = NULL);
504 
505 template< class field_type >
506 field_type & put_field( field_type & field ,
507  EntityRank entity_rank ,
508  const Part & part ,
509  unsigned n1 ,
510  unsigned n2 ,
511  unsigned n3 ,
512  unsigned n4 ,
513  const void* init_value = NULL);
514 
515 template< class field_type >
516 field_type & put_field( field_type & field ,
517  EntityRank entity_rank ,
518  const Part & part ,
519  unsigned n1 ,
520  unsigned n2 ,
521  unsigned n3 ,
522  unsigned n4 ,
523  unsigned n5 ,
524  const void* init_value = NULL);
525 
526 template< class field_type >
527 field_type & put_field( field_type & field ,
528  EntityRank entity_rank ,
529  const Part & part ,
530  unsigned n1 ,
531  unsigned n2 ,
532  unsigned n3 ,
533  unsigned n4 ,
534  unsigned n5 ,
535  unsigned n6 ,
536  const void* init_value = NULL);
537 
538 template< class field_type >
539 field_type & put_field( field_type & field ,
540  EntityRank entity_rank ,
541  const Part & part ,
542  unsigned n1 ,
543  unsigned n2 ,
544  unsigned n3 ,
545  unsigned n4 ,
546  unsigned n5 ,
547  unsigned n6 ,
548  unsigned n7 ,
549  const void* init_value = NULL);
553 } // namespace mesh
554 } // namespace stk_classic
555 
556 //----------------------------------------------------------------------
557 //----------------------------------------------------------------------
558 
559 #ifndef DOXYGEN_COMPILE
560 
561 namespace stk_classic {
562 namespace mesh {
563 
564 inline
565 Part & MetaData::get_part( unsigned ord ) const
566 { return * m_part_repo.get_all_parts()[ord] ; }
567 
568 template< class field_type >
569 inline
570 field_type * MetaData::get_field( const std::string & name ) const
571 {
572  typedef FieldTraits< field_type > Traits ;
573 
574  const DataTraits & dt = data_traits< typename Traits::data_type >();
575 
576  const shards::ArrayDimTag * tags[8] ;
577 
578  Traits::assign_tags( tags );
579 
580  FieldBase * const field =
581  m_field_repo.get_field( "stk_classic::mesh::MetaData::get_field" ,
582  name , dt , Traits::Rank , tags , 0 );
583 
584  return static_cast< field_type * >( field );
585 }
586 
587 template< class field_type >
588 inline
589 field_type & MetaData::declare_field( const std::string & name ,
590  unsigned number_of_states )
591 {
592  typedef FieldTraits< field_type > Traits ;
593 
594  const DataTraits & dt = data_traits< typename Traits::data_type >();
595 
596  const shards::ArrayDimTag * tags[8] ;
597 
598  Traits::assign_tags( tags );
599 
600  return * static_cast< field_type * >(
601  declare_field_base( name , dt , Traits::Rank , tags , number_of_states ) );
602 }
603 
604 template< class field_type >
605 inline
606 field_type & put_field(
607  field_type & field ,
608  EntityRank entity_rank ,
609  const Part & part ,
610  const void* init_value)
611 {
612  typedef FieldTraits< field_type > Traits ;
613  typedef typename Traits::Helper Helper ;
614 
615  unsigned stride[8] ;
616 
617  Helper::assign( stride );
618 
619  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
620 
621  return field ;
622 }
623 
624 template< class field_type >
625 inline
626 field_type & put_field(
627  field_type & field ,
628  EntityRank entity_rank ,
629  const Selector & selector ,
630  const void* init_value)
631 {
632  typedef FieldTraits< field_type > Traits ;
633  typedef typename Traits::Helper Helper ;
634 
635  unsigned stride[8] ;
636 
637  Helper::assign( stride );
638 
639  MetaData::get(field).declare_field_restriction( field, entity_rank, selector, stride, init_value);
640 
641  return field ;
642 }
643 
644 template< class field_type >
645 inline
646 field_type & put_field( field_type &field ,
647  EntityRank entity_rank ,
648  const Part &part ,
649  unsigned n1 ,
650  const void* init_value )
651 {
652  typedef FieldTraits< field_type > Traits ;
653  typedef typename Traits::Helper Helper ;
654 
655  unsigned stride[8] ;
656 
657  Helper::assign( stride , n1 );
658 
659  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
660 
661  return field ;
662 }
663 
664 template< class field_type >
665 inline
666 field_type & put_field( field_type &field ,
667  EntityRank entity_rank ,
668  const Selector &selector ,
669  unsigned n1 ,
670  const void* init_value )
671 {
672  typedef FieldTraits< field_type > Traits ;
673  typedef typename Traits::Helper Helper ;
674 
675  unsigned stride[8] ;
676 
677  Helper::assign( stride , n1 );
678 
679  MetaData::get(field).declare_field_restriction( field, entity_rank, selector, stride, init_value);
680 
681  return field ;
682 }
683 
684 template< class field_type >
685 inline
686 field_type & put_field( field_type &field ,
687  EntityRank entity_rank ,
688  const Part &part ,
689  unsigned n1 ,
690  unsigned n2 ,
691  const void* init_value )
692 {
693  typedef FieldTraits< field_type > Traits ;
694  typedef typename Traits::Helper Helper ;
695 
696  unsigned stride[8] ;
697 
698  Helper::assign( stride , n1 , n2 );
699 
700  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
701 
702  return field ;
703 }
704 
705 template< class field_type >
706 inline
707 field_type & put_field( field_type &field ,
708  EntityRank entity_rank ,
709  const Selector &selector ,
710  unsigned n1 ,
711  unsigned n2 ,
712  const void* init_value )
713 {
714  typedef FieldTraits< field_type > Traits ;
715  typedef typename Traits::Helper Helper ;
716 
717  unsigned stride[8] ;
718 
719  Helper::assign( stride , n1 , n2 );
720 
721  MetaData::get(field).declare_field_restriction( field, entity_rank, selector, stride, init_value);
722 
723  return field ;
724 }
725 
726 template< class field_type >
727 inline
728 field_type & put_field( field_type &field ,
729  EntityRank entity_rank ,
730  const Part &part ,
731  unsigned n1 ,
732  unsigned n2 ,
733  unsigned n3 ,
734  const void* init_value )
735 {
736  typedef FieldTraits< field_type > Traits ;
737  typedef typename Traits::Helper Helper ;
738 
739  unsigned stride[8] ;
740 
741  Helper::assign( stride , n1 , n2 , n3 );
742 
743  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
744 
745  return field ;
746 }
747 
748 template< class field_type >
749 inline
750 field_type & put_field( field_type &field ,
751  EntityRank entity_rank ,
752  const Selector &selector ,
753  unsigned n1 ,
754  unsigned n2 ,
755  unsigned n3 ,
756  const void* init_value )
757 {
758  typedef FieldTraits< field_type > Traits ;
759  typedef typename Traits::Helper Helper ;
760 
761  unsigned stride[8] ;
762 
763  Helper::assign( stride , n1 , n2 , n3 );
764 
765  MetaData::get(field).declare_field_restriction( field, entity_rank, selector, stride, init_value);
766 
767  return field ;
768 }
769 
770 template< class field_type >
771 inline
772 field_type & put_field( field_type &field ,
773  EntityRank entity_rank ,
774  const Part &part ,
775  unsigned n1 ,
776  unsigned n2 ,
777  unsigned n3 ,
778  unsigned n4 ,
779  const void* init_value )
780 {
781  typedef FieldTraits< field_type > Traits ;
782  typedef typename Traits::Helper Helper ;
783 
784  unsigned stride[8] ;
785 
786  Helper::assign( stride , n1 , n2 , n3 , n4 );
787 
788  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
789 
790  return field ;
791 }
792 
793 template< class field_type >
794 inline
795 field_type & put_field( field_type &field ,
796  EntityRank entity_rank ,
797  const Part &part ,
798  unsigned n1 ,
799  unsigned n2 ,
800  unsigned n3 ,
801  unsigned n4 ,
802  unsigned n5 ,
803  const void* init_value )
804 {
805  typedef FieldTraits< field_type > Traits ;
806  typedef typename Traits::Helper Helper ;
807 
808  unsigned stride[8] ;
809 
810  Helper::assign( stride , n1 , n2 , n3 , n4, n5 );
811 
812  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
813 
814  return field ;
815 }
816 
817 template< class field_type >
818 inline
819 field_type & put_field( field_type &field ,
820  EntityRank entity_rank ,
821  const Part &part ,
822  unsigned n1 ,
823  unsigned n2 ,
824  unsigned n3 ,
825  unsigned n4 ,
826  unsigned n5 ,
827  unsigned n6 ,
828  const void* init_value )
829 {
830  typedef FieldTraits< field_type > Traits ;
831  typedef typename Traits::Helper Helper ;
832 
833  unsigned stride[8] ;
834 
835  Helper::assign( stride , n1 , n2 , n3 , n4, n5, n6 );
836 
837  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
838 
839  return field ;
840 }
841 
842 template< class field_type >
843 inline
844 field_type & put_field( field_type &field ,
845  EntityRank entity_rank ,
846  const Part &part ,
847  unsigned n1 ,
848  unsigned n2 ,
849  unsigned n3 ,
850  unsigned n4 ,
851  unsigned n5 ,
852  unsigned n6 ,
853  unsigned n7 ,
854  const void* init_value )
855 {
856  typedef FieldTraits< field_type > Traits ;
857  typedef typename Traits::Helper Helper ;
858 
859  unsigned stride[8] ;
860 
861  Helper::assign( stride , n1 , n2 , n3 , n4, n5, n6, n7 );
862 
863  MetaData::get(field).declare_field_restriction( field, entity_rank, part, stride, init_value);
864 
865  return field ;
866 }
867 
868 template<class T>
869 inline
870 const T *
872 {
873  require_not_committed();
874  return m_attributes.insert_with_delete( a );
875 }
876 
877 template<class T>
878 inline
879 const T *
880 MetaData::get_attribute() const
881 { return m_attributes.get<T>(); }
882 
883 template<class T>
884 inline
885 const T *
886 MetaData::declare_attribute_no_delete( const T * attribute )
887 {
888  require_not_committed();
889  return m_attributes.insert_no_delete( attribute );
890 }
891 
892 template<class T>
893 inline
894 bool
895 MetaData::remove_attribute( const T * a )
896 {
897  return m_attributes.remove( a );
898 }
899 
900 template<class T>
901 inline
902 const T *
903 MetaData::declare_attribute_with_delete( Part & part , const T * attribute )
904 {
905  require_not_committed();
906  return m_part_repo.declare_attribute_with_delete( part, attribute );
907 }
908 
909 template<class T>
910 inline
911 const T *
912 MetaData::declare_attribute_no_delete( Part & part , const T * attribute )
913 {
914  require_not_committed();
915  return m_part_repo.declare_attribute_no_delete( part, attribute );
916 }
917 
918 template<class T>
919 inline
920 bool
921 MetaData::remove_attribute( Part & part , const T * attribute )
922 {
923  return m_part_repo.remove_attribute(part, attribute);
924 }
925 
926 template<class T>
927 inline
928 const T *
929 MetaData::declare_attribute_with_delete( FieldBase & field , const T * attribute )
930 {
931  require_not_committed();
932  return m_field_repo.declare_attribute_with_delete(field, attribute);
933 }
934 
935 template<class T>
936 inline
937 const T *
938 MetaData::declare_attribute_no_delete( FieldBase & field , const T * attribute )
939 {
940  require_not_committed();
941  return m_field_repo.declare_attribute_no_delete(field, attribute);
942 }
943 
944 //----------------------------------------------------------------------
945 
946 template< class PointerFieldType , class ReferencedFieldType >
947 inline
949  PointerFieldType & pointer_field ,
950  relation_stencil_ptr stencil ,
951  ReferencedFieldType & referenced_field )
952 {
953  typedef typename FieldTraits< PointerFieldType >::data_type pointer_type ;
954  typedef typename FieldTraits< ReferencedFieldType >::data_type data_type ;
955 
956  StaticAssert< SameType< pointer_type , data_type * >::value >::ok();
957  StaticAssert< FieldTraits< PointerFieldType >::Rank == 1 >::ok();
958 
959  internal_declare_field_relation( pointer_field , stencil , referenced_field );
960 }
961 
962 //----------------------------------------------------------------------
963 
964 template< typename DataType >
965 inline
966 Property<DataType> *
967 MetaData::get_property( const std::string & name ) const
968 {
969  Property<void> * const pv = get_property_base( name, typeid(DataType) );
970  return pv ? pv->property<DataType>() : (Property<DataType>*) NULL ;
971 }
972 
973 template< typename DataType >
974 inline
975 Property<DataType> &
976 MetaData::declare_property( const std::string & name , unsigned size )
977 {
978  Property<void> * pv = get_property_base(name,typeid(DataType),size);
979  Property<DataType> * prop = NULL ;
980 
981  if ( pv != NULL ) {
982  prop = pv->property<DataType>();
983  }
984  else {
985  if ( 1 == size ) {
986  pv = prop = new Property<DataType>( *this , m_properties.size() , name );
987  }
988  else {
989  pv = prop = new Property< std::vector<DataType> >(
990  *this , m_properties.size() , name , size );
991  }
992  m_properties.push_back( pv );
993  }
994  return *prop ;
995 }
996 
997 inline
998 void MetaData::put_property( PropertyBase & property , Part & part )
999 {
1000  property.add_property( part.mesh_meta_data_ordinal() );
1001 }
1002 
1003 inline
1004 bool MetaData::check_rank(EntityRank rank) const
1005 {
1006  return rank < m_entity_rank_names.size();
1007 }
1008 
1009 inline
1010 bool
1011 is_auto_declared_part(const Part &part)
1012 {
1013  const std::string &part_name = part.name();
1014 
1015  return !part_name.empty() && part_name[0] == '{';
1016 }
1017 
1018 } // namespace mesh
1019 } // namespace stk_classic
1020 
1021 #endif /* DOXYGEN_COMPILE */
1022 
1023 //----------------------------------------------------------------------
1024 //----------------------------------------------------------------------
1025 
1026 #endif /* stk_mesh_MetaData_hpp */
void verify_parallel_consistency(const MetaData &s, ParallelMachine pm)
Verify that the meta data is identical on all processors.
Definition: MetaData.cpp:501
Property with defined data type and multi-dimensions (if any)
FEMMetaData is a class that implements a Finite Element Method skin on top of the Sierra Tool Kit Met...
Definition: FEMMetaData.hpp:54
Field base class with an anonymous data type and anonymous multi-dimension.
Definition: FieldBase.hpp:53
The manager of an integrated collection of parts and fields.
Definition: MetaData.hpp:56
void declare_part_subset(Part &superset, Part &subset)
Declare a superset-subset relationship between parts.
Definition: MetaData.cpp:240
Data for ghosting mesh entities.
Definition: Ghosting.hpp:28
This is a class for selecting buckets based on a set of meshparts and set logic.
Definition: Selector.hpp:112
Part & globally_shared_part() const
Subset for the problem domain that is shared with another process. Ghost entities are not members of ...
Definition: MetaData.hpp:98
Part * get_part(const std::string &p_name, const char *required_by=NULL) const
Get an existing part by its application-defined text name.
Definition: MetaData.cpp:185
MetaData()
Construct a meta data manager to own parts and fields.
Definition: MetaData.cpp:133
const FieldVector & get_fields() const
Get all defined fields.
Definition: MetaData.hpp:218
field_type & put_field(field_type &field, EntityRank entity_rank, const Part &part, const void *init_value=NULL)
Declare a field to exist for a given entity type and Part.
const std::vector< PropertyBase *> & get_properties() const
Get all defined properties.
Definition: MetaData.hpp:308
An application-defined subset of a problem domain.
Definition: Part.hpp:49
Part & universal_part() const
Universal subset for the problem domain. All other parts are a subset of the universal part...
Definition: MetaData.hpp:88
const T * insert_no_delete(const T *)
Part & locally_owned_part() const
Subset for the problem domain that is owned by the local process. Ghost entities are not members of t...
Definition: MetaData.hpp:93
unsigned get_spatial_dimension() const
Definition: MetaData.hpp:325
void put_property(PropertyBase &property, Part &part)
Put a property on the given part.
const std::vector< FieldRelation > & get_field_relations() const
Get all field relations.
Definition: MetaData.hpp:270
Part & declare_part(const std::string &p_name, EntityRank rank)
Declare a part of the given name and entity rank Redeclaration returns the previously declared part...
Definition: MetaData.cpp:214
FieldBase * declare_field_base(const std::string &arg_name, const DataTraits &arg_traits, unsigned arg_rank, const shards::ArrayDimTag *const *arg_dim_tags, unsigned arg_num_states)
Declare a field via runtime type information.
Definition: MetaData.cpp:284
void declare_field_relation(PointerFieldType &pointer_field, relation_stencil_ptr stencil, ReferencedFieldType &referenced_field)
Declare a field relation.
const T * get() const
~MetaData()
Destroy the meta data manager and all of the parts and fields that it owns.
Definition: MetaData.cpp:375
void set_entity_rank_names(const std::vector< std::string > &entity_rank_names)
entity-rank names
Definition: MetaData.cpp:155
bool remove(const T *)
Manager for an integrated collection of entities, entity relations, and buckets of field data...
Definition: BulkData.hpp:49
const T * insert_with_delete(const T *)
const T * declare_attribute_with_delete(Part &part, const T *attribute)
Declare an attribute on a part. Return the attribute of that type, which may be an already existing v...
A fundamental unit within the discretization of a problem domain, including but not limited to nodes...
Definition: Entity.hpp:120
Property< DataType > & declare_property(const std::string &name, unsigned size=1)
Declare a property of the given type, name, and dimensions.
Sierra Toolkit.
bool check_rank(EntityRank rank) const
const PartVector & get_parts() const
Query all parts of the mesh ordered by the parts&#39; ordinal.
Definition: MetaData.hpp:120
MPI_Comm ParallelMachine
Definition: Parallel.hpp:32
Property< DataType > * get_property(const std::string &name) const
Get a property, return NULL if it does not exist.
int(* relation_stencil_ptr)(unsigned from_type, unsigned to_type, unsigned identifier)
A relation stencil maps entity relationships to ordinals.
Definition: Types.hpp:149
void declare_part_relation(Part &root_part, relation_stencil_ptr stencil, Part &target_part)
Declare an entity-relationship between parts.
Definition: MetaData.cpp:257
field_type & declare_field(const std::string &name, unsigned number_of_states=1)
Declare a field of the given field_type, test name, and number of states.
bool is_commit() const
Query if the meta data manager is committed.
Definition: MetaData.hpp:338
std::vector< Part *> PartVector
Collections of parts are frequently maintained as a vector of Part pointers.
Definition: Types.hpp:31
Property base class with an anonymous data type and anonymous multi-dimension.
Set of entities of arbitrary types.
Definition: CSet.hpp:51
A container for the field data of a homogeneous collection of entities.
Definition: Bucket.hpp:94
EntityRank entity_rank(const EntityKey &key)
Given an entity key, return an entity type (rank).
field_type * get_field(const std::string &name) const
Get a field, return NULL if it does not exist.
void commit()
Commit the part and field declarations so that the meta data manager can be used to create mesh bulk ...
Definition: MetaData.cpp:368
void declare_field_restriction(FieldBase &arg_field, EntityRank arg_entity_rank, const Part &arg_part, const unsigned *arg_stride, const void *arg_init_value=NULL)
Declare a field restriction via runtime type information.
Definition: MetaData.cpp:303