TopologyId getCellTopologyId( const CellTopology & cell_topology) { if (cell_topology.getCellTopologyData() == 0) return INVALID; IdCellTopologyMap &cell_topology_map = get_id_cell_topology_map(); IdCellTopologyMap::const_iterator it = cell_topology_map.find(cell_topology); if (it == cell_topology_map.end()) { //throw RuntimeError() << "Cell topology " << cell_topology.getName() << " is not defined"; std::ostringstream msg; msg << "Cell topology " << cell_topology.getName() << " is not defined"; throw std::runtime_error(msg.str()); } return (*it).second; }
CellTopology get_cell_topology_new( const Bucket & bucket) { const BulkData & bulk_data = BulkData::get(bucket); const FEMMetaData & fem_meta_data = FEMMetaData::get(bulk_data); const PartVector & all_parts = fem_meta_data.get_parts(); CellTopology cell_topology; const std::pair< const unsigned *, const unsigned * > supersets = bucket.superset_part_ordinals(); if (supersets.first != supersets.second) { const Part *first_found_part = NULL; for ( const unsigned * it = supersets.first ; it != supersets.second ; ++it ) { const Part & part = * all_parts[*it] ; if ( part.primary_entity_rank() == bucket.entity_rank() ) { CellTopology top = fem_meta_data.get_cell_topology( part ); if ( ! cell_topology.getCellTopologyData() ) { cell_topology = top ; if (!first_found_part) first_found_part = ∂ } else { ThrowErrorMsgIf( top.getCellTopologyData() && top != cell_topology, "Cell topology is ambiguously defined. It is defined as " << cell_topology.getName() << " on part " << first_found_part->name() << " and as " << top.getName() << " on its superset part " << part.name() ); } } } } return cell_topology ; }