Skip to content

Commit f47ca0d

Browse files
authored
Merge pull request #27 from gismo/domainIteratorFixes
Adoption of new domain iterators in G+Smo
2 parents 8efd199 + 9d22321 commit f47ca0d

File tree

2 files changed

+47
-45
lines changed

2 files changed

+47
-45
lines changed

examples/example_shell3D_DWR.cpp

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -466,10 +466,11 @@ int main(int argc, char *argv[])
466466
else
467467
numError = DWR->computeError(dualL,dualH);
468468

469-
typename gsBasis<real_t>::domainIter domIt = basisL.basis(0).makeDomainIterator();
470-
real_t diam = domIt->getMinCellLength();
471-
for (; domIt->good(); domIt->next())
472-
diam = domIt->getMinCellLength() < diam ? domIt->getMinCellLength() : diam;
469+
typename gsBasis<real_t>::domainIter domIt = basisL.basis(0).domain()->beginAll();
470+
typename gsBasis<real_t>::domainIter domItEnd = basisL.basis(0).domain()->endAll();
471+
real_t diam = domIt.getMinCellLength();
472+
for (; domIt<domItEnd; ++domIt)
473+
diam = domIt.getMinCellLength() < diam ? domIt.getMinCellLength() : diam;
473474

474475
exacts[r] = 0;
475476
numGoal[r] = DWR->computeGoal(mp_def)+DWR->computeGoal(bContainer,mp_def)+DWR->computeGoal(points,mp_def);
@@ -507,13 +508,13 @@ int main(int argc, char *argv[])
507508
index_t c = 0;
508509
for (index_t p=0; p < mp.nPieces(); ++p)
509510
{
510-
// index_t p=0;
511-
typename gsBasis<real_t>::domainIter domIt = mp.basis(p).makeDomainIterator();
512-
gsHDomainIterator<real_t,2> * domHIt = nullptr;
513-
domHIt = dynamic_cast<gsHDomainIterator<real_t,2> *>(domIt.get());
514-
GISMO_ENSURE(domHIt!=nullptr,"Domain not loaded");
515-
for (; domHIt->good(); domHIt->next())
511+
// index_t p=0;
512+
typename gsBasis<real_t>::domainIter domIt = mp.basis(p).domain()->beginAll();
513+
typename gsBasis<real_t>::domainIter domItEnd = mp.basis(p).domain()->endAll();
514+
for (; domIt<domItEnd; ++domIt)
516515
{
516+
GISMO_ASSERT((dynamic_cast<gsHDomainIterator<real_t,2> *>(domIt.get())),"Domain not loaded");
517+
gsHDomainIterator<real_t,2> * domHIt = static_cast<gsHDomainIterator<real_t,2> *>(domIt.get());
517518
gsHBox<2,real_t> box(domHIt,p);
518519
box.setAndProjectError(elErrors[c],mesherOpts.getInt("Convergence_alpha"),mesherOpts.getInt("Convergence_beta"));
519520
elts.add(box);
@@ -568,12 +569,12 @@ int main(int argc, char *argv[])
568569
for (index_t p=0; p < mp.nPieces(); ++p)
569570
{
570571
// index_t p=0;
571-
typename gsBasis<real_t>::domainIter domIt = mp.basis(p).makeDomainIterator();
572-
gsHDomainIterator<real_t,2> * domHIt = nullptr;
573-
domHIt = dynamic_cast<gsHDomainIterator<real_t,2> *>(domIt.get());
574-
GISMO_ENSURE(domHIt!=nullptr,"Domain not loaded");
575-
for (; domHIt->good(); domHIt->next())
572+
typename gsBasis<real_t>::domainIter domIt = mp.basis(p).domain()->beginAll();
573+
typename gsBasis<real_t>::domainIter domItEnd = mp.basis(p).domain()->endAll();
574+
for (; domIt<domItEnd; ++domIt)
576575
{
576+
GISMO_ASSERT((dynamic_cast<gsHDomainIterator<real_t,2> *>(domIt.get())),"Domain not loaded");
577+
gsHDomainIterator<real_t,2> * domHIt = static_cast<gsHDomainIterator<real_t,2> *>(domIt.get());
577578
gsHBox<2,real_t> box(domHIt,p);
578579
box.setAndProjectError(elErrors[c],mesherOpts.getInt("Convergence_alpha"),mesherOpts.getInt("Convergence_beta"));
579580
elts.add(box);

src/gsThinShellAssemblerDWR.hpp

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
12361236
for (index_t k = 0; k!=points.cols(); k++)
12371237
{
12381238
tmp = ev.eval(expr,points.col(k));
1239-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1239+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
12401240
for (index_t j = 0; j< space.dim(); ++j)
12411241
{
12421242
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1252,7 +1252,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
12521252
for (index_t k = 0; k!=points.cols(); k++)
12531253
{
12541254
tmp = ev.eval(expr,points.col(k));
1255-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1255+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
12561256
for (index_t j = 0; j< space.dim(); ++j)
12571257
{
12581258
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1271,7 +1271,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
12711271
for (index_t k = 0; k!=points.cols(); k++)
12721272
{
12731273
tmp = ev.eval(expr,points.col(k));
1274-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1274+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
12751275
for (index_t j = 0; j< space.dim(); ++j)
12761276
{
12771277
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1287,7 +1287,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
12871287
for (index_t k = 0; k!=points.cols(); k++)
12881288
{
12891289
tmp = ev.eval(expr,points.col(k));
1290-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1290+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
12911291
for (index_t j = 0; j< space.dim(); ++j)
12921292
{
12931293
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1306,7 +1306,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13061306
for (index_t k = 0; k!=points.cols(); k++)
13071307
{
13081308
tmp = ev.eval(expr,points.col(k));
1309-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1309+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13101310
for (index_t j = 0; j< space.dim(); ++j)
13111311
{
13121312
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1322,7 +1322,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13221322
for (index_t k = 0; k!=points.cols(); k++)
13231323
{
13241324
tmp = ev.eval(expr,points.col(k));
1325-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1325+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13261326
for (index_t j = 0; j< space.dim(); ++j)
13271327
{
13281328
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1341,7 +1341,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13411341
for (index_t k = 0; k!=points.cols(); k++)
13421342
{
13431343
tmp = ev.eval(expr,points.col(k));
1344-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1344+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13451345
for (index_t j = 0; j< space.dim(); ++j)
13461346
{
13471347
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1357,7 +1357,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13571357
for (index_t k = 0; k!=points.cols(); k++)
13581358
{
13591359
tmp = ev.eval(expr,points.col(k));
1360-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1360+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13611361
for (index_t j = 0; j< space.dim(); ++j)
13621362
{
13631363
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1376,7 +1376,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13761376
for (index_t k = 0; k!=points.cols(); k++)
13771377
{
13781378
tmp = ev.eval(expr,points.col(k));
1379-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1379+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13801380
for (index_t j = 0; j< space.dim(); ++j)
13811381
{
13821382
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1392,7 +1392,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
13921392
for (index_t k = 0; k!=points.cols(); k++)
13931393
{
13941394
tmp = ev.eval(expr,points.col(k));
1395-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1395+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
13961396
for (index_t j = 0; j< space.dim(); ++j)
13971397
{
13981398
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1411,7 +1411,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14111411
for (index_t k = 0; k!=points.cols(); k++)
14121412
{
14131413
tmp = ev.eval(expr,points.col(k));
1414-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1414+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
14151415
for (index_t j = 0; j< space.dim(); ++j)
14161416
{
14171417
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1427,7 +1427,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14271427
for (index_t k = 0; k!=points.cols(); k++)
14281428
{
14291429
tmp = ev.eval(expr,points.col(k));
1430-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1430+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
14311431
for (index_t j = 0; j< space.dim(); ++j)
14321432
{
14331433
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1446,7 +1446,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14461446
for (index_t k = 0; k!=points.cols(); k++)
14471447
{
14481448
tmp = ev.eval(expr,points.col(k));
1449-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1449+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
14501450
for (index_t j = 0; j< space.dim(); ++j)
14511451
{
14521452
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1463,7 +1463,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14631463
for (index_t k = 0; k!=points.cols(); k++)
14641464
{
14651465
tmp = ev.eval(expr,points.col(k));
1466-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1466+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
14671467
for (index_t j = 0; j< space.dim(); ++j)
14681468
{
14691469
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1482,7 +1482,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14821482
for (index_t k = 0; k!=points.cols(); k++)
14831483
{
14841484
tmp = ev.eval(expr,points.col(k));
1485-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1485+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
14861486
for (index_t j = 0; j< space.dim(); ++j)
14871487
{
14881488
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1498,7 +1498,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
14981498
for (index_t k = 0; k!=points.cols(); k++)
14991499
{
15001500
tmp = ev.eval(expr,points.col(k));
1501-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1501+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
15021502
for (index_t j = 0; j< space.dim(); ++j)
15031503
{
15041504
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1517,7 +1517,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
15171517
for (index_t k = 0; k!=points.cols(); k++)
15181518
{
15191519
tmp = ev.eval(expr,points.col(k));
1520-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1520+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
15211521
for (index_t j = 0; j< space.dim(); ++j)
15221522
{
15231523
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1533,7 +1533,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
15331533
for (index_t k = 0; k!=points.cols(); k++)
15341534
{
15351535
tmp = ev.eval(expr,points.col(k));
1536-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1536+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
15371537
for (index_t j = 0; j< space.dim(); ++j)
15381538
{
15391539
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1552,7 +1552,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
15521552
for (index_t k = 0; k!=points.cols(); k++)
15531553
{
15541554
tmp = ev.eval(expr,points.col(k));
1555-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1555+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
15561556
for (index_t j = 0; j< space.dim(); ++j)
15571557
{
15581558
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -1569,7 +1569,7 @@ ThinShellAssemblerStatus gsThinShellAssemblerDWR<d, T, bending>::_assembleDual(c
15691569
for (index_t k = 0; k!=points.cols(); k++)
15701570
{
15711571
tmp = ev.eval(expr,points.col(k));
1572-
exprAssembler.integrationElements().basis(pIndex).active_into( points.col(k), actives );
1572+
exprAssembler.trialSpace(0).source().basis(pIndex).active_into( points.col(k), actives );
15731573
for (index_t j = 0; j< space.dim(); ++j)
15741574
{
15751575
space.mapper().localToGlobal(actives, pIndex, globalActives,j);
@@ -3685,19 +3685,20 @@ void gsThinShellAssemblerDWR<d, T, bending>::_applyLoadsToElWiseError(const gsMu
36853685
for (unsigned patchInd=0; patchInd < m_assemblerH->getBasis().nBases(); ++patchInd)
36863686
{
36873687
// Initialize domain element iterator
3688-
typename gsBasis<T>::domainIter domIt =
3689-
m_assemblerH->getBasis().piece(patchInd).makeDomainIterator();
3688+
typename gsBasis<T>::domainIter domIt = m_assemblerH->getBasis().piece(patchInd).domain()->beginAll();
3689+
typename gsBasis<T>::domainIter domItEnd = m_assemblerH->getBasis().piece(patchInd).domain()->endAll();
36903690

3691-
#ifdef _OPENMP
3691+
# ifdef _OPENMP
36923692
c = patch_cnt + tid;
3693-
patch_cnt += domIt->numElements();// a bit costy
3694-
for ( domIt->next(tid); domIt->good(); domIt->next(nt) )
3695-
#else
3696-
for (; domIt->good(); domIt->next() )
3697-
#endif
3693+
patch_cnt += m_assemblerH->getBasis().piece(patchInd).domain()->numElements();// a bit costy
3694+
domIt += tid;
3695+
for ( ; domIt<domItEnd; domIt+=nt )
3696+
# else
3697+
for (; domIt<domItEnd; ++domIt )
3698+
# endif
36983699
{
3699-
bool test = !(((((forcePoint - domIt->lowerCorner()).array() >= 0) &&
3700-
(domIt->upperCorner() - forcePoint).array() >= 0) ).array() == 0).any();
3700+
bool test = !(((((forcePoint - domIt.lowerCorner()).array() >= 0) &&
3701+
(domIt.upperCorner() - forcePoint).array() >= 0) ).array() == 0).any();
37013702
if (test)
37023703
elements_private.push_back(c);
37033704
#ifdef _OPENMP

0 commit comments

Comments
 (0)