Nektar++
Loading...
Searching...
No Matches
Functions
Nektar::ContFieldLocalToGlobalMapTest Namespace Reference

Functions

 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapSameTypes)
 
 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapOtherTypes)
 
 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapSingular)
 
 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapPeriodic)
 
 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapSharedCopy)
 
 BOOST_AUTO_TEST_CASE (TestContFieldLocalToGlobalMapNotShared)
 

Function Documentation

◆ BOOST_AUTO_TEST_CASE() [1/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapNotShared  )

The map of a copy that pins a degree of freedom of a singular system is not shared, and the field's own lookup still returns it. A field with element expansions of its own shares nothing with the field.

Definition at line 444 of file TestContFieldLocalToGlobalMap.cpp.

445{
446 Fixture fixture("u,v,w,p,q", variables, conditions);
447
448 auto field = fixture.Field("u");
450 *field, fixture.graph, "q", true, true);
451 BOOST_REQUIRE(singularQ->GetLocalToGlobalMap()->GetSingularSystem());
452
454 field->GetLocalToGlobalMap("q");
455 BOOST_CHECK(mapQ != singularQ->GetLocalToGlobalMap());
456 BOOST_CHECK(!mapQ->GetSingularSystem());
457 BOOST_CHECK(singularQ->GetLocalToGlobalMap("q") ==
458 singularQ->GetLocalToGlobalMap());
459
460 auto fieldW = fixture.Field("w");
461 BOOST_REQUIRE(fieldW->GetExp() != field->GetExp());
463 field->GetLocalToGlobalMap("w");
464 BOOST_CHECK(mapW != fieldW->GetLocalToGlobalMap());
465 CheckSameMap(mapW, fieldW->GetLocalToGlobalMap());
466}
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
std::shared_ptr< AssemblyMapCG > AssemblyMapCGSharedPtr

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ BOOST_AUTO_TEST_CASE() [2/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapOtherTypes  )

A variable with other types of boundary conditions gets a map of its own, kept for later calls and equal to the map of a field built for it.

Definition at line 338 of file TestContFieldLocalToGlobalMap.cpp.

339{
340 Fixture fixture("u,v,w,p,q", variables, conditions);
341 BOOST_REQUIRE(fixture.graph->SameExpansionInfo("u", "w"));
342
343 auto field = fixture.Field("u");
345 field->GetLocalToGlobalMap("w");
346 BOOST_REQUIRE(mapW);
347 BOOST_CHECK(mapW != field->GetLocalToGlobalMap());
348 BOOST_CHECK(field->GetLocalToGlobalMap("w") == mapW);
349
350 // w is Neumann on two sides, so it has fewer Dirichlet dofs than u.
351 BOOST_CHECK_LT(mapW->GetNumGlobalDirBndCoeffs(),
352 field->GetLocalToGlobalMap()->GetNumGlobalDirBndCoeffs());
353
354 CheckSameMap(mapW, fixture.Field("w")->GetLocalToGlobalMap());
355}

◆ BOOST_AUTO_TEST_CASE() [3/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapPeriodic  )

On a periodic mesh, a variable with the same types of boundary conditions shares the field's map and one with other types gets a map equal to that of a field built for it.

Definition at line 386 of file TestContFieldLocalToGlobalMap.cpp.

387{
388 Fixture fixture("u,v,w", periodicVariables, periodicConditions);
389
390 auto field = fixture.Field("u");
391 MultiRegions::PeriodicMap periodicVerts, periodicEdges;
392 field->GetPeriodicEntities(periodicVerts, periodicEdges);
393 BOOST_REQUIRE(!periodicEdges.empty());
394
395 BOOST_CHECK(field->GetLocalToGlobalMap("v") ==
396 field->GetLocalToGlobalMap());
397
399 field->GetLocalToGlobalMap("w");
400 BOOST_REQUIRE(mapW);
401 BOOST_CHECK(mapW != field->GetLocalToGlobalMap());
402
403 CheckSameMap(mapW, fixture.Field("w")->GetLocalToGlobalMap());
404}
std::map< int, std::vector< PeriodicEntity > > PeriodicMap

◆ BOOST_AUTO_TEST_CASE() [4/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapSameTypes  )

A variable with the same types of boundary conditions shares the field's own map, and the field's own variable returns it directly.

Definition at line 317 of file TestContFieldLocalToGlobalMap.cpp.

318{
319 Fixture fixture("u,v,w,p,q", variables, conditions);
320 BOOST_REQUIRE(fixture.graph->SameExpansionInfo("u", "v"));
321
322 auto field = fixture.Field("u");
324 field->GetLocalToGlobalMap();
325
326 BOOST_CHECK(field->GetLocalToGlobalMap("u") == own);
327
329 field->GetLocalToGlobalMap("v");
330 BOOST_CHECK(mapV == own);
331 BOOST_CHECK(&field->GetLocalToGlobalMap("v") == &mapV);
332}

◆ BOOST_AUTO_TEST_CASE() [5/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapSharedCopy  )

A copy for another variable adds its map to those the field shares with it, and the lookup then returns that map instead of building one.

Definition at line 410 of file TestContFieldLocalToGlobalMap.cpp.

411{
412 Fixture fixture("u,v,w,p,q", variables, conditions);
413
414 auto field = fixture.Field("u");
416 *field, fixture.graph, "w", true, false);
417 BOOST_REQUIRE(copyW->GetLocalToGlobalMap() != field->GetLocalToGlobalMap());
418 BOOST_CHECK(field->GetLocalToGlobalMap("w") ==
419 copyW->GetLocalToGlobalMap());
420
421 // A copy sharing the field's map adds it for its own variable and leaves
422 // the field's own map in place.
424 *field, fixture.graph, "v", true, false);
425 BOOST_CHECK(field->GetLocalToGlobalMap("u") ==
426 field->GetLocalToGlobalMap());
427 BOOST_CHECK(field->GetLocalToGlobalMap("v") ==
428 field->GetLocalToGlobalMap());
429
430 // The copies look up the maps there too, also once the copy has gone.
431 BOOST_CHECK(copyV->GetLocalToGlobalMap("w") ==
432 copyW->GetLocalToGlobalMap());
434 copyW->GetLocalToGlobalMap();
435 copyW.reset();
436 BOOST_CHECK(field->GetLocalToGlobalMap("w") == mapW);
437}

References Nektar::MemoryManager< DataType >::AllocateSharedPtr().

◆ BOOST_AUTO_TEST_CASE() [6/6]

Nektar::ContFieldLocalToGlobalMapTest::BOOST_AUTO_TEST_CASE ( TestContFieldLocalToGlobalMapSingular  )

A map that pins a degree of freedom of a singular system is not shared, even with a variable whose boundary conditions are of the same types.

Definition at line 361 of file TestContFieldLocalToGlobalMap.cpp.

362{
363 Fixture fixture("u,v,w,p,q", variables, conditions);
364
365 auto field = fixture.Field("p", true);
367 field->GetLocalToGlobalMap();
368 BOOST_REQUIRE(own->GetSingularSystem());
369 BOOST_REQUIRE_GT(own->GetNumGlobalDirBndCoeffs(), 0);
370
372 field->GetLocalToGlobalMap("q");
373 BOOST_REQUIRE(mapQ);
374 BOOST_CHECK(mapQ != own);
375 BOOST_CHECK(!mapQ->GetSingularSystem());
376 BOOST_CHECK_EQUAL(mapQ->GetNumGlobalDirBndCoeffs(), 0);
377
378 CheckSameMap(mapQ, fixture.Field("q")->GetLocalToGlobalMap());
379}