Beispiel #1
0
void createPointNeighbors ( MeshType const& mesh, neighborList_Type& neighborList )
{
    neighborList.resize ( mesh.numGlobalPoints() );
    // generate point neighbors by watching edges
    // note: this can be based also on faces or volumes
    for ( UInt ie = 0; ie < mesh.numEdges(); ie++ )
    {
        ID id0 = mesh.edge ( ie ).point ( 0 ).id();
        ID id1 = mesh.edge ( ie ).point ( 1 ).id();

        ASSERT ( mesh.point ( id0 ).id() == id0 && mesh.point ( id1 ).id() == id1,
                 "the mesh has been reordered, the point must be found" );

        neighborList[ id0 ].insert ( id1 );
        neighborList[ id1 ].insert ( id0 );
    }
}
Beispiel #2
0
void createPointNeighbors ( MeshType& mesh )
{
    // TODO: ASSERT_COMPILE_TIME that MeshType::pointMarker == NeighborMarker
    // this guarantees that the pointNeighbors structure is available.

    // generate point neighbors by watching edges
    // note: this can be based also on faces or volumes
    for ( UInt ie = 0; ie < mesh.numEdges(); ie++ )
    {
        ID id0 = mesh.edge ( ie ).point ( 0 ).id();
        ID id1 = mesh.edge ( ie ).point ( 1 ).id();

        ASSERT ( mesh.point ( id0 ).id() == id0 , "the mesh has been reordered, the point must be found" );
        ASSERT ( mesh.point ( id1 ).id() == id1 , "the mesh has been reordered, the point must be found" );

        mesh.point ( id0 ).pointNeighbors().insert ( id1 );
        mesh.point ( id1 ).pointNeighbors().insert ( id0 );
    }
}
void test(const shared_ptr< DistanceOctree< MeshType > > & distanceOctree, const MeshType & mesh, const AABB & domainAABB, Vector3<uint_t> numBlocks)
{
   Vector3<real_t> blockSize(domainAABB.xSize() / real_c(numBlocks[0]),
      domainAABB.ySize() / real_c(numBlocks[1]),
      domainAABB.zSize() / real_c(numBlocks[2]));

   real_t maxError = blockSize.min() / real_t(10);

   SetupBlockForest setupBlockforest;
   setupBlockforest.addRootBlockExclusionFunction(F(distanceOctree, maxError));
   setupBlockforest.addWorkloadMemorySUIDAssignmentFunction(blockforest::uniformWorkloadAndMemoryAssignment);


   setupBlockforest.init(domainAABB, numBlocks[0], numBlocks[1], numBlocks[2], false, false, false);
   WALBERLA_LOG_DEVEL(setupBlockforest.toString());


   std::vector< Vector3<real_t> > vertexPositions;
   vertexPositions.reserve(mesh.n_vertices());
   for (auto vIt = mesh.vertices_begin(); vIt != mesh.vertices_end(); ++vIt)
   {
      vertexPositions.push_back(toWalberla(mesh.point(*vIt)));
   }

   std::vector< const blockforest::SetupBlock* > setupBlocks;
   setupBlockforest.getBlocks(setupBlocks);

   // Check wether all vertices are located in allocated blocks
   std::vector< Vector3<real_t> > uncoveredVertices(vertexPositions);

   for (auto bIt = setupBlocks.begin(); bIt != setupBlocks.end(); ++bIt)
   {
      const AABB & aabb = (*bIt)->getAABB();

      uncoveredVertices.erase(std::remove_if(uncoveredVertices.begin(), uncoveredVertices.end(), PointInAABB(aabb)), uncoveredVertices.end());
   }

   WALBERLA_CHECK(uncoveredVertices.empty(), "Not all vertices of the mesh are located in allocated blocks!");

   //setupBlockforest.assignAllBlocksToRootProcess();
   //setupBlockforest.writeVTKOutput( "setupblockforest" );
}