| 1 |
// @HEADER |
| 2 |
// ***************************************************************************** |
| 3 |
// Panzer: A partial differential equation assembly |
| 4 |
// engine for strongly coupled complex multiphysics systems |
| 5 |
// |
| 6 |
// Copyright 2011 NTESS and the Panzer contributors. |
| 7 |
// SPDX-License-Identifier: BSD-3-Clause |
| 8 |
// ***************************************************************************** |
| 9 |
// @HEADER |
| 10 |
|
| 11 |
#include <Teuchos_ConfigDefs.hpp> |
| 12 |
#include <Teuchos_UnitTestHarness.hpp> |
| 13 |
|
| 14 |
#include "Shards_CellTopology.hpp" |
| 15 |
#include "Shards_BasicTopologies.hpp" |
| 16 |
|
| 17 |
#include "Phalanx_KokkosDeviceTypes.hpp" |
| 18 |
|
| 19 |
#include "Panzer_PointDescriptor.hpp" |
| 20 |
#include "Panzer_BasisDescriptor.hpp" |
| 21 |
#include "Panzer_PointGenerator.hpp" |
| 22 |
|
| 23 |
#include "Panzer_IntrepidBasisFactory.hpp" |
| 24 |
|
| 25 |
namespace panzer { |
| 26 |
|
| 27 |
TEUCHOS_UNIT_TEST(point_descriptor, construction) |
| 28 |
{ |
| 29 |
TEST_THROW(PointDescriptor("none",Teuchos::null),std::logic_error); |
| 30 |
|
| 31 |
BasisDescriptor desc_a(4,"HDiv"); |
| 32 |
BasisDescriptor desc_b(2,"HGrad"); |
| 33 |
PointDescriptor pd_a = desc_a.getPointDescriptor(); |
| 34 |
PointDescriptor pd_b = desc_b.getPointDescriptor(); |
| 35 |
|
| 36 |
TEST_ASSERT(pd_a.getType()!=pd_b.getType()); |
| 37 |
TEST_ASSERT(pd_a.getKey()!=pd_b.getKey()); |
| 38 |
|
| 39 |
const PointGenerator & gen_a = pd_a.getGenerator(); |
| 40 |
const PointGenerator & gen_b = pd_b.getGenerator(); |
| 41 |
|
| 42 |
shards::CellTopology myHex(shards::getCellTopologyData<shards::Hexahedron<8> >()); |
| 43 |
shards::CellTopology myTet(shards::getCellTopologyData<shards::Tetrahedron<4> >()); |
| 44 |
|
| 45 |
// check gen_a |
| 46 |
{ |
| 47 |
Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> > |
| 48 |
intrepid_basis = createIntrepid2Basis<PHX::Device::execution_space,double,double>("HDiv",4,myHex); |
| 49 |
|
| 50 |
auto hex_pts = gen_a.getPoints(myHex); |
| 51 |
|
| 52 |
TEST_EQUALITY(Teuchos::as<int>(hex_pts.extent(0)),intrepid_basis->getCardinality()); |
| 53 |
TEST_EQUALITY(Teuchos::as<int>(hex_pts.extent(1)),3); |
| 54 |
} |
| 55 |
|
| 56 |
// check gen_b |
| 57 |
{ |
| 58 |
Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> > |
| 59 |
intrepid_basis_hex = createIntrepid2Basis<PHX::Device::execution_space,double,double>("HGrad",2,myHex); |
| 60 |
Teuchos::RCP<Intrepid2::Basis<PHX::Device::execution_space,double,double> > |
| 61 |
intrepid_basis_tet = createIntrepid2Basis<PHX::Device::execution_space,double,double>("HGrad",2,myTet); |
| 62 |
|
| 63 |
auto tet_pts = gen_b.getPoints(myTet); |
| 64 |
auto hex_pts = gen_b.getPoints(myHex); |
| 65 |
|
| 66 |
TEST_EQUALITY(Teuchos::as<int>(hex_pts.extent(0)),intrepid_basis_hex->getCardinality()); |
| 67 |
TEST_EQUALITY(hex_pts.extent(1),3); |
| 68 |
|
| 69 |
TEST_EQUALITY(Teuchos::as<int>(tet_pts.extent(0)),intrepid_basis_tet->getCardinality()); |
| 70 |
TEST_EQUALITY(tet_pts.extent(1),3); |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|
| 75 |
} |