void fillFieldContainer(int fieldNum,const std::string & blockId,
                        const panzer::UniqueGlobalIndexer<short,int> & ugi,
                        Intrepid::FieldContainer<int> & data)
{
   data.resize(1,4);

   const std::vector<short> & elements = ugi.getElementBlock(blockId);
   const std::vector<int> & fieldOffsets = ugi.getGIDFieldOffsets(blockId,fieldNum);
   std::vector<int> gids;
   for(std::size_t e=0;e<elements.size();e++) {
      ugi.getElementGIDs(elements[e],gids);
      for(std::size_t f=0;f<fieldOffsets.size();f++)
         data(e,f) = gids[fieldOffsets[f]];
   }
}
Example #2
0
/** Get the coordinates for a specified element block and field pattern.
  */
void STKConnManager::getDofCoords(const std::string & blockId,
                                  const panzer::IntrepidFieldPattern & coordProvider,
                                  std::vector<std::size_t> & localCellIds,
                                  Intrepid::FieldContainer<double> & points) const
{
   int dim = coordProvider.getDimension();
   int numIds = coordProvider.numberIds();

   // grab element vertices
   Intrepid::FieldContainer<double> vertices;
   workset_utils::getIdsAndVertices(*stkMeshDB_,blockId,localCellIds,vertices);

   // setup output array
   points.resize(localCellIds.size(),numIds,dim);
   coordProvider.getInterpolatoryCoordinates(vertices,points);
}
/** Get the local coordinates for this field. This is independent of element
  * locations.
  *
  * \param[in,out] coords   Coordinates associated with this field type.
  */
void IntrepidFieldPattern::getInterpolatoryCoordinates(Intrepid::FieldContainer<double> & coords) const
{
   typedef Intrepid::DofCoordsInterface<Intrepid::FieldContainer<double> > CoordsInterface;

   using Teuchos::RCP;
   using Teuchos::rcp_dynamic_cast;

   bool throwOnFail = true;

   // cast basis object to DofCoordsInterface: throw on failure
   RCP<CoordsInterface> coordsInterface
         = rcp_dynamic_cast<CoordsInterface>(intrepidBasis_,throwOnFail);

   // resize coordinates
   coords.resize(intrepidBasis_->getCardinality(),getDimension());
   coordsInterface->getDofCoords(coords);
}
/** Get the local coordinates for this field. This is independent of element
  * locations.
  *
  * \param[in,out] coords   Coordinates associated with this field type.
  */
void IntrepidFieldPattern::getInterpolatoryCoordinates(const Intrepid::FieldContainer<double> & cellVertices,
                                                       Intrepid::FieldContainer<double> & coords) const
{
   TEUCHOS_ASSERT(cellVertices.rank()==3);

   int numCells = cellVertices.dimension(0);

   // grab the local coordinates
   Intrepid::FieldContainer<double> localCoords;
   getInterpolatoryCoordinates(localCoords);

   // resize the coordinates field container
   coords.resize(numCells,localCoords.dimension(0),getDimension());

   if(numCells>0) {
      // map to phsyical coordinates
      Intrepid::CellTools<double> cellTools;
      cellTools.mapToPhysicalFrame(coords,localCoords,cellVertices,intrepidBasis_->getBaseCellTopology());
   }
}