Esempio n. 1
0
void FineCoarseMeshPair<DIM>::ComputeCoarseElementsForFineElementCentroids(bool safeMode)
{
    if (mpCoarseMeshBoxCollection==NULL)
    {
        EXCEPTION("Call SetUpBoxesOnCoarseMesh() before ComputeCoarseElementsForFineElementCentroids()");
    }

    #define COVERAGE_IGNORE
    if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
    {
        std::cout << "\nComputing coarse elements for fine element centroids\n";
    }
    #undef COVERAGE_IGNORE

    mCoarseElementsForFineElementCentroids.resize(mrFineMesh.GetNumElements());

    ResetStatisticsVariables();
    for (unsigned i=0; i<mrFineMesh.GetNumElements(); i++)
    {
        #define COVERAGE_IGNORE
        if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
        {
            std::cout << "\t" << i << " of " << mrFineMesh.GetNumElements() << std::flush;
        }
        #undef COVERAGE_IGNORE

        c_vector<double,DIM> point_cvec = mrFineMesh.GetElement(i)->CalculateCentroid();
        ChastePoint<DIM> point(point_cvec);

        // Get the box this point is in
        unsigned box_for_this_point = mpCoarseMeshBoxCollection->CalculateContainingBox( point_cvec );

        mCoarseElementsForFineElementCentroids[i] = ComputeCoarseElementForGivenPoint(point, safeMode, box_for_this_point);
    }
}
Esempio n. 2
0
FineCoarseMeshPair<DIM>::FineCoarseMeshPair(AbstractTetrahedralMesh<DIM,DIM>& rFineMesh, AbstractTetrahedralMesh<DIM,DIM>& rCoarseMesh)
    : mrFineMesh(rFineMesh),
      mrCoarseMesh(rCoarseMesh),
      mpFineMeshBoxCollection(NULL),
      mpCoarseMeshBoxCollection(NULL)
{
    ResetStatisticsVariables();
}
Esempio n. 3
0
void FineCoarseMeshPair<DIM>::ComputeFineElementsAndWeightsForCoarseQuadPoints(GaussianQuadratureRule<DIM>& rQuadRule,
                                                                               bool safeMode)
{
    if (mpFineMeshBoxCollection == NULL)
    {
        EXCEPTION("Call SetUpBoxesOnFineMesh() before ComputeFineElementsAndWeightsForCoarseQuadPoints()");
    }

    // Get the quad point (physical) positions
    QuadraturePointsGroup<DIM> quad_point_posns(mrCoarseMesh, rQuadRule);

    // Resize the elements and weights vector.
    mFineMeshElementsAndWeights.resize(quad_point_posns.Size());

    #define COVERAGE_IGNORE
    if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
    {
        std::cout << "\nComputing fine elements and weights for coarse quad points\n";
    }
    #undef COVERAGE_IGNORE


    ResetStatisticsVariables();
    for (unsigned i=0; i<quad_point_posns.Size(); i++)
    {
        #define COVERAGE_IGNORE
        if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
        {
            std::cout << "\t" << i << " of " << quad_point_posns.Size() << std::flush;
        }
        #undef COVERAGE_IGNORE

        // Get the box this point is in
        unsigned box_for_this_point = mpFineMeshBoxCollection->CalculateContainingBox( quad_point_posns.rGet(i) );
        if (mpFineMeshBoxCollection->IsBoxOwned(box_for_this_point))
        {
            // A chaste point version of the c-vector is needed for the GetContainingElement call.
            ChastePoint<DIM> point(quad_point_posns.rGet(i));

            ComputeFineElementAndWeightForGivenPoint(point, safeMode, box_for_this_point, i);
        }
        else
        {
            assert(mFineMeshElementsAndWeights[i].ElementNum == 0u); // and the weight is zero too...
        }
    }
    ShareFineElementData();
    if (mStatisticsCounters[1] > 0)
    {
        WARNING(mStatisticsCounters[1] << " of " << quad_point_posns.Size() << " coarse-mesh quadrature points were outside the fine mesh");
    }
}
Esempio n. 4
0
void FineCoarseMeshPair<DIM>::ComputeFineElementsAndWeightsForCoarseNodes(bool safeMode)
{
    if (mpFineMeshBoxCollection==NULL)
    {
        EXCEPTION("Call SetUpBoxesOnFineMesh() before ComputeFineElementsAndWeightsForCoarseNodes()");
    }

    // Resize the elements and weights vector.
    mFineMeshElementsAndWeights.resize(mrCoarseMesh.GetNumNodes());

    #define COVERAGE_IGNORE
    if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
    {
        std::cout << "\nComputing fine elements and weights for coarse nodes\n";
    }
    #undef COVERAGE_IGNORE


    ResetStatisticsVariables();
    for (unsigned i=0; i<mrCoarseMesh.GetNumNodes(); i++)
    {
        #define COVERAGE_IGNORE
        if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
        {
            std::cout << "\t" << i << " of " << mrCoarseMesh.GetNumNodes() << std::flush;
        }
        #undef COVERAGE_IGNORE

        Node<DIM>* p_node = mrCoarseMesh.GetNode(i);

        // Get the box this point is in
        unsigned box_for_this_point = mpFineMeshBoxCollection->CalculateContainingBox( p_node->rGetModifiableLocation() );
        if (mpFineMeshBoxCollection->IsBoxOwned(box_for_this_point))
        {
            // A chaste point version of the c-vector is needed for the GetContainingElement call
            ChastePoint<DIM> point(p_node->rGetLocation());

            ComputeFineElementAndWeightForGivenPoint(point, safeMode, box_for_this_point, i);
        }
    }
    ShareFineElementData();
}
Esempio n. 5
0
void FineCoarseMeshPair<DIM>::ComputeCoarseElementsForFineNodes(bool safeMode)
{
    if (mpCoarseMeshBoxCollection==NULL)
    {
        EXCEPTION("Call SetUpBoxesOnCoarseMesh() before ComputeCoarseElementsForFineNodes()");
    }

    #define COVERAGE_IGNORE
    if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
    {
        std::cout << "\nComputing coarse elements for fine nodes\n";
    }
    #undef COVERAGE_IGNORE
    mCoarseElementsForFineNodes.clear();
    mCoarseElementsForFineNodes.resize(mrFineMesh.GetNumNodes(), 0.0);

    ResetStatisticsVariables();
    for (unsigned i=0; i<mCoarseElementsForFineNodes.size(); i++)
    {
        #define COVERAGE_IGNORE
        if(CommandLineArguments::Instance()->OptionExists("-mesh_pair_verbose"))
        {
            std::cout << "\t" << i << " of " << mCoarseElementsForFineNodes.size() << std::flush;
        }
        #undef COVERAGE_IGNORE

        ChastePoint<DIM> point = mrFineMesh.GetNode(i)->GetPoint();

        // Get the box this point is in
        unsigned box_for_this_point = mpCoarseMeshBoxCollection->CalculateContainingBox(mrFineMesh.GetNode(i)->rGetModifiableLocation());
        if (mpCoarseMeshBoxCollection->IsBoxOwned(box_for_this_point))
        {
            mCoarseElementsForFineNodes[i] = ComputeCoarseElementForGivenPoint(point, safeMode, box_for_this_point);
        }
    }
    ShareCoarseElementData();
}