gismo icon indicating copy to clipboard operation
gismo copied to clipboard

how to speed up the refinement process of hierarchical b-splines

Open skyforcen73 opened this issue 8 years ago • 2 comments

hello,

i realized that that refinement process of hierarchical b-splines using "refineElements()" is very slow. For the following hierarchical domain:

Hierarchical B-spline basis of dimension 2, levels=10, size=3097, tree_nodes=969). Domain: [-1.75 -1.75]..[1.75 1.75]. Size per level: 1058 774 279 225 188 91 118 284 80

If i just refine one single cell to the next level ( l = 10), it takes about 100 seconds! So my question is how could i speed up the refinement process?

you can find the whole hierarchical domain in this text-file, which i uploaded under the following link: hb.txt

many thanks in advance skyforce

skyforcen73 avatar Jun 28 '17 09:06 skyforcen73

Hi,

Yes, for many levels it can take more time, due to the large size of the tree or so. Before running into conclusions one should profile the code to see where the time is spent. Can you also post the code so that I can also execute it ?

filiatra avatar Jun 29 '17 09:06 filiatra

hi,

hier is the test-code. First you have to rename the "hb.txt" file to "hb.xml", then the programm can read the basis structures.

int main(int argc, char *argv[])
{
    gsCPUStopwatch time;

    gsFileData<> fileData("location of hb.xml");

    time.restart();
    gsBasis<>::uPtr pBasis;
    if (fileData.has< gsBasis<> >())
    {
        pBasis = fileData.getFirst< gsBasis<> >();
    }
    else
    {
        gsInfo << "Input file doesn't have a geometry inside." << "\n";
        return -1;
    }

    gsInfo<<"Time for reading the basis from xml: "<< time.stop()<<"\n\n";
    gsInfo<<*pBasis;

    gsMatrix<> box(2,2);
    box<<1, 1.5, 0, 0.5;

    time.restart();
    pBasis->refine(box);
    gsInfo<<"Time for refinement: "<< time.stop()<<"\n\n";
}

skyforcen73 avatar Jun 29 '17 09:06 skyforcen73