| 1 |
#include <gtest/gtest.h> // for AssertHelper, EXPECT_EQ, etc |
| 2 |
|
| 3 |
#include <memory> |
| 4 |
#include <vector> |
| 5 |
#include <string> |
| 6 |
#include <algorithm> |
| 7 |
|
| 8 |
#include <stk_mesh/base/GetEntities.hpp> |
| 9 |
#include <stk_mesh/base/BulkData.hpp> |
| 10 |
#include <stk_mesh/base/MetaData.hpp> // for MetaData |
| 11 |
#include "stk_unit_test_utils/BuildMesh.hpp" |
| 12 |
#include <stk_unit_test_utils/ioUtils.hpp> |
| 13 |
#include <stk_unit_test_utils/MeshFixture.hpp> |
| 14 |
#include <stk_unit_test_utils/TextMesh.hpp> |
| 15 |
#include "stk_mesh/base/Comm.hpp" |
| 16 |
#include <stk_mesh/base/FEMHelpers.hpp> |
| 17 |
#include <stk_mesh/base/SideSetUtil.hpp> |
| 18 |
#include <stk_mesh/base/SidesetUpdater.hpp> |
| 19 |
#include <stk_mesh/base/PolarityUtil.hpp> |
| 20 |
|
| 21 |
#include "stk_mesh/base/ExodusTranslator.hpp" |
| 22 |
|
| 23 |
class TestTextMesh : public stk::unit_test_util::MeshFixture |
| 24 |
{ |
| 25 |
protected: |
| 26 |
TestTextMesh() |
| 27 |
{ |
| 28 |
setup_empty_mesh(stk::mesh::BulkData::NO_AUTO_AURA); |
| 29 |
} |
| 30 |
|
| 31 |
void inititalize_2D_mesh() |
| 32 |
{ |
| 33 |
reset_mesh(); |
| 34 |
unsigned spatialDim = 2u; |
| 35 |
set_spatial_dimension(spatialDim); |
| 36 |
setup_empty_mesh(stk::mesh::BulkData::NO_AUTO_AURA); |
| 37 |
} |
| 38 |
|
| 39 |
void test_polarity(const stk::mesh::EntityIdVector& nodeIds, const unsigned ordinal, const bool expectedPolarity) |
| 40 |
{ |
| 41 |
stk::mesh::EntityVector nodes; |
| 42 |
stk::mesh::Entity elem1 = get_bulk().get_entity(stk::topology::ELEM_RANK, 1u); |
| 43 |
EXPECT_TRUE(get_bulk().is_valid(elem1)); |
| 44 |
|
| 45 |
for (auto nodeId : nodeIds) |
| 46 |
{ |
| 47 |
stk::mesh::Entity node = get_bulk().get_entity(stk::topology::NODE_RANK, nodeId); |
| 48 |
EXPECT_TRUE(get_bulk().is_valid(node)); |
| 49 |
nodes.push_back(node); |
| 50 |
} |
| 51 |
stk::mesh::EquivAndPositive result = is_side_equivalent_and_positive(get_bulk(), elem1, ordinal, nodes); |
| 52 |
EXPECT_TRUE(result.is_equiv); |
| 53 |
EXPECT_EQ(expectedPolarity, result.is_positive); |
| 54 |
} |
| 55 |
}; |
| 56 |
|
| 57 |
typedef TestTextMesh TestQuad4; |
| 58 |
|
| 59 |
TEST_F(TestQuad4, createNodeOrderingAndTestPolarity) |
| 60 |
{ |
| 61 |
std::string meshDesc = "0,1,QUAD_4_2D,1,2,3,4"; |
| 62 |
if (get_bulk().parallel_size() == 1) |
| 63 |
{ |
| 64 |
inititalize_2D_mesh(); |
| 65 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 66 |
|
| 67 |
{ |
| 68 |
stk::mesh::EntityIdVector nodeIds = {1, 2}; |
| 69 |
unsigned ordinal = 0; |
| 70 |
bool expectedPositivePolarity = true; |
| 71 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 72 |
} |
| 73 |
{ |
| 74 |
stk::mesh::EntityIdVector nodeIds = {2, 1}; |
| 75 |
unsigned ordinal = 0; |
| 76 |
bool expectedPositivePolarity = false; |
| 77 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
typedef TestTextMesh TestQuad9; |
| 83 |
|
| 84 |
TEST_F(TestQuad9, createNodeOrderingAndTestPolarity) |
| 85 |
{ |
| 86 |
std::string meshDesc = "0,1,QUAD_9_2D,1,2,3,4,5,6,7,8,9"; |
| 87 |
if (get_bulk().parallel_size() == 1) |
| 88 |
{ |
| 89 |
inititalize_2D_mesh(); |
| 90 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 91 |
|
| 92 |
{ |
| 93 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 5}; |
| 94 |
unsigned ordinal = 0; |
| 95 |
bool expectedPositivePolarity = true; |
| 96 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 97 |
} |
| 98 |
{ |
| 99 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 5}; |
| 100 |
unsigned ordinal = 0; |
| 101 |
bool expectedPositivePolarity = false; |
| 102 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 103 |
} |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
typedef TestTextMesh TestTri3; |
| 108 |
|
| 109 |
TEST_F(TestTri3, createNodeOrderingAndTestPolarity) |
| 110 |
{ |
| 111 |
std::string meshDesc = "0,1,TRI_3_2D,1,2,3"; |
| 112 |
if (get_bulk().parallel_size() == 1) |
| 113 |
{ |
| 114 |
inititalize_2D_mesh(); |
| 115 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 116 |
|
| 117 |
{ |
| 118 |
stk::mesh::EntityIdVector nodeIds = {1, 2}; |
| 119 |
unsigned ordinal = 0; |
| 120 |
bool expectedPositivePolarity = true; |
| 121 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 122 |
} |
| 123 |
{ |
| 124 |
stk::mesh::EntityIdVector nodeIds = {2, 1}; |
| 125 |
unsigned ordinal = 0; |
| 126 |
bool expectedPositivePolarity = false; |
| 127 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 128 |
} |
| 129 |
} |
| 130 |
} |
| 131 |
|
| 132 |
typedef TestTextMesh TestTri6; |
| 133 |
|
| 134 |
TEST_F(TestTri6, createNodeOrderingAndTestPolarity) |
| 135 |
{ |
| 136 |
std::string meshDesc = "0,1,TRI_6_2D,1,2,3,4,5,6"; |
| 137 |
if (get_bulk().parallel_size() == 1) |
| 138 |
{ |
| 139 |
inititalize_2D_mesh(); |
| 140 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 141 |
|
| 142 |
{ |
| 143 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 4}; |
| 144 |
unsigned ordinal = 0; |
| 145 |
bool expectedPositivePolarity = true; |
| 146 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 147 |
} |
| 148 |
{ |
| 149 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 4}; |
| 150 |
unsigned ordinal = 0; |
| 151 |
bool expectedPositivePolarity = false; |
| 152 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 153 |
} |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
typedef TestTextMesh TestHex8; |
| 158 |
|
| 159 |
TEST_F(TestHex8, createNodeOrderingAndTestPolarity) |
| 160 |
{ |
| 161 |
std::string meshDesc = "0,1,HEX_8,1,2,3,4,5,6,7,8"; |
| 162 |
if (get_bulk().parallel_size() == 1) |
| 163 |
{ |
| 164 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 165 |
|
| 166 |
{ |
| 167 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 6, 5}; |
| 168 |
unsigned ordinal = 0; |
| 169 |
bool expectedPositivePolarity = true; |
| 170 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 171 |
} |
| 172 |
{ |
| 173 |
stk::mesh::EntityIdVector nodeIds = {5, 6, 2, 1}; |
| 174 |
unsigned ordinal = 0; |
| 175 |
bool expectedPositivePolarity = false; |
| 176 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 177 |
} |
| 178 |
} |
| 179 |
} |
| 180 |
|
| 181 |
typedef TestTextMesh TestHex20; |
| 182 |
|
| 183 |
TEST_F(TestHex20, createNodeOrderingAndTestPolarity) |
| 184 |
{ |
| 185 |
std::string meshDesc = "0,1,HEX_20,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20"; |
| 186 |
if (get_bulk().parallel_size() == 1) |
| 187 |
{ |
| 188 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 189 |
|
| 190 |
{ |
| 191 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 6, 5, 9, 14, 17, 13}; |
| 192 |
unsigned ordinal = 0; |
| 193 |
bool expectedPositivePolarity = true; |
| 194 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 195 |
} |
| 196 |
{ |
| 197 |
stk::mesh::EntityIdVector nodeIds = {1, 5, 6, 2, 13, 17, 14, 9}; |
| 198 |
unsigned ordinal = 0; |
| 199 |
bool expectedPositivePolarity = false; |
| 200 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 201 |
} |
| 202 |
} |
| 203 |
} |
| 204 |
|
| 205 |
typedef TestTextMesh TestPyramid5; |
| 206 |
|
| 207 |
TEST_F(TestPyramid5, createNodeOrderingAndTestPolarity) |
| 208 |
{ |
| 209 |
std::string meshDesc = "0,1,PYRAMID_5,1,2,3,4,5"; |
| 210 |
if (get_bulk().parallel_size() == 1) |
| 211 |
{ |
| 212 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 213 |
|
| 214 |
{ |
| 215 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 5}; |
| 216 |
unsigned ordinal = 0; |
| 217 |
bool expectedPositivePolarity = true; |
| 218 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 219 |
} |
| 220 |
{ |
| 221 |
stk::mesh::EntityIdVector nodeIds = {4, 3, 2, 1}; |
| 222 |
unsigned ordinal = 4; |
| 223 |
bool expectedPositivePolarity = true; |
| 224 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 225 |
} |
| 226 |
{ |
| 227 |
stk::mesh::EntityIdVector nodeIds = {1, 5, 2}; |
| 228 |
unsigned ordinal = 0; |
| 229 |
bool expectedPositivePolarity = false; |
| 230 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 231 |
} |
| 232 |
{ |
| 233 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4}; |
| 234 |
unsigned ordinal = 4; |
| 235 |
bool expectedPositivePolarity = false; |
| 236 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 237 |
} |
| 238 |
} |
| 239 |
} |
| 240 |
|
| 241 |
typedef TestTextMesh TestPyramid13; |
| 242 |
|
| 243 |
TEST_F(TestPyramid13, createNodeOrderingAndTestPolarity) |
| 244 |
{ |
| 245 |
std::string meshDesc = "0,1,PYRAMID_13,1,2,3,4,5,6,7,8,9,10,11,12,13"; |
| 246 |
if (get_bulk().parallel_size() == 1) |
| 247 |
{ |
| 248 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 249 |
|
| 250 |
{ |
| 251 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 5, 6, 11, 10}; |
| 252 |
unsigned ordinal = 0; |
| 253 |
bool expectedPositivePolarity = true; |
| 254 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 255 |
} |
| 256 |
{ |
| 257 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 3, 2, 9, 8, 7, 6}; |
| 258 |
unsigned ordinal = 4; |
| 259 |
bool expectedPositivePolarity = true; |
| 260 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 261 |
} |
| 262 |
{ |
| 263 |
stk::mesh::EntityIdVector nodeIds = {1, 5, 2, 10, 11, 6}; |
| 264 |
unsigned ordinal = 0; |
| 265 |
bool expectedPositivePolarity = false; |
| 266 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 267 |
} |
| 268 |
{ |
| 269 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4, 6, 7, 8, 9}; |
| 270 |
unsigned ordinal = 4; |
| 271 |
bool expectedPositivePolarity = false; |
| 272 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 273 |
} |
| 274 |
} |
| 275 |
} |
| 276 |
|
| 277 |
typedef TestTextMesh TestTet4; |
| 278 |
|
| 279 |
TEST_F(TestTet4, createNodeOrderingAndTestPolarity) |
| 280 |
{ |
| 281 |
std::string meshDesc = "0,1,TET_4,1,2,3,4"; |
| 282 |
if (get_bulk().parallel_size() == 1) |
| 283 |
{ |
| 284 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 285 |
|
| 286 |
{ |
| 287 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 4}; |
| 288 |
unsigned ordinal = 0; |
| 289 |
bool expectedPositivePolarity = true; |
| 290 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 291 |
} |
| 292 |
{ |
| 293 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 2}; |
| 294 |
unsigned ordinal = 0; |
| 295 |
bool expectedPositivePolarity = false; |
| 296 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 297 |
} |
| 298 |
} |
| 299 |
} |
| 300 |
|
| 301 |
typedef TestTextMesh TestTet10; |
| 302 |
|
| 303 |
TEST_F(TestTet10, createNodeOrderingAndTestPolarity) |
| 304 |
{ |
| 305 |
std::string meshDesc = "0,1,TET_10,1,2,3,4,5,6,7,8,9,10"; |
| 306 |
if (get_bulk().parallel_size() == 1) |
| 307 |
{ |
| 308 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 309 |
|
| 310 |
{ |
| 311 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 4, 5, 9, 8}; |
| 312 |
unsigned ordinal = 0; |
| 313 |
bool expectedPositivePolarity = true; |
| 314 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 315 |
} |
| 316 |
{ |
| 317 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 2, 8, 9, 5}; |
| 318 |
unsigned ordinal = 0; |
| 319 |
bool expectedPositivePolarity = false; |
| 320 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 321 |
} |
| 322 |
} |
| 323 |
} |
| 324 |
|
| 325 |
typedef TestTextMesh TestWedge6; |
| 326 |
|
| 327 |
TEST_F(TestWedge6, createNodeOrderingAndTestPolarity) |
| 328 |
{ |
| 329 |
std::string meshDesc = "0,1,WEDGE_6,1,2,3,4,5,6"; |
| 330 |
if (get_bulk().parallel_size() == 1) |
| 331 |
{ |
| 332 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 333 |
|
| 334 |
{ |
| 335 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 5, 4}; |
| 336 |
unsigned ordinal = 0; |
| 337 |
bool expectedPositivePolarity = true; |
| 338 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 339 |
} |
| 340 |
{ |
| 341 |
stk::mesh::EntityIdVector nodeIds = {1, 3, 2}; |
| 342 |
unsigned ordinal = 3; |
| 343 |
bool expectedPositivePolarity = true; |
| 344 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 345 |
} |
| 346 |
{ |
| 347 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 5, 2}; |
| 348 |
unsigned ordinal = 0; |
| 349 |
bool expectedPositivePolarity = false; |
| 350 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 351 |
} |
| 352 |
{ |
| 353 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 354 |
unsigned ordinal = 3; |
| 355 |
bool expectedPositivePolarity = false; |
| 356 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 357 |
} |
| 358 |
} |
| 359 |
} |
| 360 |
|
| 361 |
typedef TestTextMesh TestWedge15; |
| 362 |
|
| 363 |
TEST_F(TestWedge15, createNodeOrderingAndTestPolarity) |
| 364 |
{ |
| 365 |
std::string meshDesc = "0,1,WEDGE_15,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15"; |
| 366 |
if (get_bulk().parallel_size() == 1) |
| 367 |
{ |
| 368 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 369 |
|
| 370 |
{ |
| 371 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 5, 4, 7, 11, 13, 10}; |
| 372 |
unsigned ordinal = 0; |
| 373 |
bool expectedPositivePolarity = true; |
| 374 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 375 |
} |
| 376 |
{ |
| 377 |
stk::mesh::EntityIdVector nodeIds = {1, 3, 2, 9, 8, 7}; |
| 378 |
unsigned ordinal = 3; |
| 379 |
bool expectedPositivePolarity = true; |
| 380 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 381 |
} |
| 382 |
{ |
| 383 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 5, 2, 10, 13, 11, 7}; |
| 384 |
unsigned ordinal = 0; |
| 385 |
bool expectedPositivePolarity = false; |
| 386 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 387 |
} |
| 388 |
{ |
| 389 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 7, 8, 9}; |
| 390 |
unsigned ordinal = 3; |
| 391 |
bool expectedPositivePolarity = false; |
| 392 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 393 |
} |
| 394 |
} |
| 395 |
} |
| 396 |
|
| 397 |
typedef TestTextMesh TestShellLine2; |
| 398 |
|
| 399 |
TEST_F(TestShellLine2, createNodeOrderingAndTestPolarity) |
| 400 |
{ |
| 401 |
std::string meshDesc = "0,1,SHELL_LINE_2,1,2"; |
| 402 |
if (get_bulk().parallel_size() == 1) |
| 403 |
{ |
| 404 |
inititalize_2D_mesh(); |
| 405 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 406 |
|
| 407 |
{ |
| 408 |
stk::mesh::EntityIdVector nodeIds = {1, 2}; |
| 409 |
unsigned ordinal = 0; |
| 410 |
bool expectedPositivePolarity = true; |
| 411 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 412 |
} |
| 413 |
{ |
| 414 |
stk::mesh::EntityIdVector nodeIds = {2, 1}; |
| 415 |
unsigned ordinal = 0; |
| 416 |
bool expectedPositivePolarity = false; |
| 417 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 418 |
} |
| 419 |
} |
| 420 |
} |
| 421 |
|
| 422 |
typedef TestTextMesh TestShellLine3; |
| 423 |
|
| 424 |
TEST_F(TestShellLine3, createNodeOrderingAndTestPolarity) |
| 425 |
{ |
| 426 |
std::string meshDesc = "0,1,SHELL_LINE_3,1,2,3"; |
| 427 |
if (get_bulk().parallel_size() == 1) |
| 428 |
{ |
| 429 |
inititalize_2D_mesh(); |
| 430 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 431 |
|
| 432 |
{ |
| 433 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 434 |
unsigned ordinal = 0; |
| 435 |
bool expectedPositivePolarity = true; |
| 436 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 437 |
} |
| 438 |
{ |
| 439 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 3}; |
| 440 |
unsigned ordinal = 0; |
| 441 |
bool expectedPositivePolarity = false; |
| 442 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 443 |
} |
| 444 |
} |
| 445 |
} |
| 446 |
|
| 447 |
typedef TestTextMesh TestShellTri3; |
| 448 |
|
| 449 |
TEST_F(TestShellTri3, createNodeOrderingAndTestPolarity) |
| 450 |
{ |
| 451 |
std::string meshDesc = "0,1,SHELL_TRI_3,1,2,3"; |
| 452 |
if (get_bulk().parallel_size() == 1) |
| 453 |
{ |
| 454 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 455 |
|
| 456 |
{ |
| 457 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 458 |
unsigned ordinal = 0; |
| 459 |
bool expectedPositivePolarity = true; |
| 460 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 461 |
} |
| 462 |
{ |
| 463 |
stk::mesh::EntityIdVector nodeIds = {1, 2}; |
| 464 |
unsigned ordinal = 0; |
| 465 |
bool expectedPositivePolarity = true; |
| 466 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 467 |
} |
| 468 |
{ |
| 469 |
stk::mesh::EntityIdVector nodeIds = {1, 3, 2}; |
| 470 |
unsigned ordinal = 0; |
| 471 |
bool expectedPositivePolarity = false; |
| 472 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 473 |
} |
| 474 |
{ |
| 475 |
stk::mesh::EntityIdVector nodeIds = {2, 1}; |
| 476 |
unsigned ordinal = 0; |
| 477 |
bool expectedPositivePolarity = false; |
| 478 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 479 |
} |
| 480 |
} |
| 481 |
} |
| 482 |
|
| 483 |
typedef TestTextMesh TestShellTri6; |
| 484 |
|
| 485 |
TEST_F(TestShellTri6, createNodeOrderingAndTestPolarity) |
| 486 |
{ |
| 487 |
std::string meshDesc = "0,1,SHELL_TRI_6,1,2,3,4,5,6"; |
| 488 |
if (get_bulk().parallel_size() == 1) |
| 489 |
{ |
| 490 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 491 |
|
| 492 |
{ |
| 493 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4, 5, 6}; |
| 494 |
unsigned ordinal = 0; |
| 495 |
bool expectedPositivePolarity = true; |
| 496 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 497 |
} |
| 498 |
{ |
| 499 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 500 |
unsigned ordinal = 0; |
| 501 |
bool expectedPositivePolarity = true; |
| 502 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 503 |
} |
| 504 |
{ |
| 505 |
stk::mesh::EntityIdVector nodeIds = {1, 3, 2, 6, 5, 4}; |
| 506 |
unsigned ordinal = 0; |
| 507 |
bool expectedPositivePolarity = false; |
| 508 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 509 |
} |
| 510 |
{ |
| 511 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 3}; |
| 512 |
unsigned ordinal = 0; |
| 513 |
bool expectedPositivePolarity = false; |
| 514 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 515 |
} |
| 516 |
} |
| 517 |
} |
| 518 |
|
| 519 |
typedef TestTextMesh TestShellQuad4; |
| 520 |
|
| 521 |
TEST_F(TestShellQuad4, createNodeOrderingAndTestPolarity) |
| 522 |
{ |
| 523 |
std::string meshDesc = "0,1,SHELL_QUAD_4,1,2,3,4"; |
| 524 |
if (get_bulk().parallel_size() == 1) |
| 525 |
{ |
| 526 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 527 |
|
| 528 |
{ |
| 529 |
stk::mesh::EntityIdVector nodeIds = {1, 2}; |
| 530 |
unsigned ordinal = 0; |
| 531 |
bool expectedPositivePolarity = true; |
| 532 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 533 |
} |
| 534 |
{ |
| 535 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4}; |
| 536 |
unsigned ordinal = 0; |
| 537 |
bool expectedPositivePolarity = true; |
| 538 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 539 |
} |
| 540 |
{ |
| 541 |
stk::mesh::EntityIdVector nodeIds = {2, 1}; |
| 542 |
unsigned ordinal = 0; |
| 543 |
bool expectedPositivePolarity = false; |
| 544 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 545 |
} |
| 546 |
{ |
| 547 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 3, 2}; |
| 548 |
unsigned ordinal = 0; |
| 549 |
bool expectedPositivePolarity = false; |
| 550 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 551 |
} |
| 552 |
} |
| 553 |
} |
| 554 |
|
| 555 |
typedef TestTextMesh TestShellQuad8; |
| 556 |
|
| 557 |
TEST_F(TestShellQuad8, createNodeOrderingAndTestPolarity) |
| 558 |
{ |
| 559 |
std::string meshDesc = "0,1,SHELL_QUAD_8,1,2,3,4,5,6,7,8"; |
| 560 |
if (get_bulk().parallel_size() == 1) |
| 561 |
{ |
| 562 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 563 |
|
| 564 |
{ |
| 565 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 566 |
unsigned ordinal = 0; |
| 567 |
bool expectedPositivePolarity = true; |
| 568 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 569 |
} |
| 570 |
{ |
| 571 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4, 5, 6, 7, 8}; |
| 572 |
unsigned ordinal = 0; |
| 573 |
bool expectedPositivePolarity = true; |
| 574 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 575 |
} |
| 576 |
{ |
| 577 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 3}; |
| 578 |
unsigned ordinal = 0; |
| 579 |
bool expectedPositivePolarity = false; |
| 580 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 581 |
} |
| 582 |
{ |
| 583 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 3, 2, 8, 7, 6, 5}; |
| 584 |
unsigned ordinal = 0; |
| 585 |
bool expectedPositivePolarity = false; |
| 586 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 587 |
} |
| 588 |
} |
| 589 |
} |
| 590 |
|
| 591 |
typedef TestTextMesh TestShellQuad9; |
| 592 |
|
| 593 |
TEST_F(TestShellQuad9, createNodeOrderingAndTestPolarity) |
| 594 |
{ |
| 595 |
std::string meshDesc = "0,1,SHELL_QUAD_9,1,2,3,4,5,6,7,8,9"; |
| 596 |
if (get_bulk().parallel_size() == 1) |
| 597 |
{ |
| 598 |
stk::unit_test_util::setup_text_mesh(get_bulk(), meshDesc); |
| 599 |
|
| 600 |
{ |
| 601 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3}; |
| 602 |
unsigned ordinal = 0; |
| 603 |
bool expectedPositivePolarity = true; |
| 604 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 605 |
} |
| 606 |
{ |
| 607 |
stk::mesh::EntityIdVector nodeIds = {1, 2, 3, 4, 5, 6, 7, 8, 9}; |
| 608 |
unsigned ordinal = 0; |
| 609 |
bool expectedPositivePolarity = true; |
| 610 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 611 |
} |
| 612 |
{ |
| 613 |
stk::mesh::EntityIdVector nodeIds = {2, 1, 3}; |
| 614 |
unsigned ordinal = 0; |
| 615 |
bool expectedPositivePolarity = false; |
| 616 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 617 |
} |
| 618 |
{ |
| 619 |
stk::mesh::EntityIdVector nodeIds = {1, 4, 3, 2, 8, 7, 6, 5, 9}; |
| 620 |
unsigned ordinal = 0; |
| 621 |
bool expectedPositivePolarity = false; |
| 622 |
test_polarity(nodeIds, ordinal, expectedPositivePolarity); |
| 623 |
} |
| 624 |
} |
| 625 |
} |
| 626 |
|
| 627 |
void run_one_parallel_boundary_polarity_test(stk::ParallelMachine comm, |
| 628 |
stk::mesh::BulkData::AutomaticAuraOption option) |
| 629 |
{ |
| 630 |
// Create bulk |
| 631 |
stk::mesh::MeshBuilder builder(comm); |
| 632 |
builder.set_spatial_dimension(3); |
| 633 |
builder.set_aura_option(option); |
| 634 |
std::shared_ptr<stk::mesh::BulkData> bulk = builder.create(); |
| 635 |
stk::mesh::MetaData &meta = bulk->mesh_meta_data(); |
| 636 |
|
| 637 |
// Register sideset updater |
| 638 |
if (!bulk->has_observer_type<stk::mesh::SidesetUpdater>()) { |
| 639 |
stk::mesh::Selector activeSelector = meta.universal_part(); |
| 640 |
|
| 641 |
bulk->register_observer(std::make_shared<stk::mesh::IncrementalSidesetUpdater>(*bulk, activeSelector)); |
| 642 |
} |
| 643 |
|
| 644 |
// Create sideset parts |
| 645 |
std::vector<std::string> sidesetNames{"surface_1", "surface_block_1_QUAD4_1"}; |
| 646 |
stk::mesh::PartVector sidesetParts; |
| 647 |
int sidesetId = 1; |
| 648 |
for(const std::string &name : sidesetNames) |
| 649 |
{ |
| 650 |
stk::mesh::Part &part = meta.declare_part_with_topology(name, stk::topology::QUAD_4); |
| 651 |
meta.set_part_id(part, sidesetId); |
| 652 |
sidesetParts.push_back(&part); |
| 653 |
} |
| 654 |
|
| 655 |
meta.declare_part_subset(*sidesetParts[0], *sidesetParts[1]); |
| 656 |
|
| 657 |
// Build mesh |
| 658 |
std::string meshDesc = "0,1,HEX_8,1,2,3,4,5, 6, 7, 8,block_1\n" |
| 659 |
"1,2,HEX_8,5,6,7,8,9,10,11,12,block_2"; |
| 660 |
std::vector<double> coordinates = { 0,0,0, 1,0,0, 1,1,0, 0,1,0, |
| 661 |
0,0,1, 1,0,1, 1,1,1, 0,1,1, |
| 662 |
0,0,2, 1,0,2, 1,1,2, 0,1,2 }; |
| 663 |
|
| 664 |
bulk->initialize_face_adjacent_element_graph(); |
| 665 |
stk::unit_test_util::setup_text_mesh(*bulk, stk::unit_test_util::get_full_text_mesh_desc(meshDesc, coordinates)); |
| 666 |
|
| 667 |
// Create and populate sideset between elements 1 & 2, based on element 1 |
| 668 |
stk::mesh::SideSet &sideset = bulk->create_sideset(*sidesetParts[0]); |
| 669 |
sideset.set_accept_all_internal_non_coincident_entries(false); |
| 670 |
|
| 671 |
std::vector<stk::mesh::EntityId> elementIds{1, 2}; |
| 672 |
std::vector<stk::mesh::ConnectivityOrdinal> elementOrdinals{5, 4}; |
| 673 |
std::vector<stk::mesh::Entity> elements(2); |
| 674 |
elements[0] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds[0]); |
| 675 |
elements[1] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds[1]); |
| 676 |
|
| 677 |
if (bulk->is_valid(elements[0])) { |
| 678 |
sideset.add({elements[0], elementOrdinals[0]}); |
| 679 |
} |
| 680 |
|
| 681 |
// Setup surface to block mapping for the sideset updater |
| 682 |
stk::mesh::Part* block_1 = meta.get_part("block_1"); |
| 683 |
EXPECT_TRUE(block_1 != nullptr); |
| 684 |
|
| 685 |
std::vector<const stk::mesh::Part*> touchingParts{block_1}; |
| 686 |
meta.set_surface_to_block_mapping(sidesetParts[1], touchingParts); |
| 687 |
|
| 688 |
// Create faces |
| 689 |
bulk->modification_begin(); |
| 690 |
int myProc = bulk->parallel_rank(); |
| 691 |
stk::mesh::Entity face = bulk->declare_element_side(elements[myProc], elementOrdinals[myProc], sidesetParts); |
| 692 |
bulk->modification_end(); |
| 693 |
|
| 694 |
// Make sure there is only 1 global face |
| 695 |
std::vector<size_t> counts; |
| 696 |
stk::mesh::comm_mesh_counts(*bulk, counts); |
| 697 |
EXPECT_EQ(1u, counts[meta.side_rank()]); |
| 698 |
|
| 699 |
// Make sure it matches the one we created |
| 700 |
stk::mesh::EntityVector faces; |
| 701 |
stk::mesh::get_selected_entities(meta.universal_part(), bulk->buckets(meta.side_rank()), faces); |
| 702 |
EXPECT_EQ(1u, faces.size()); |
| 703 |
EXPECT_EQ(face, faces[0]); |
| 704 |
|
| 705 |
|
| 706 |
// Get polarity results with free function code |
| 707 |
std::pair<bool,bool> freePolarity1 = stk::mesh::is_positive_sideset_polarity(*bulk, *sidesetParts[1], face, |
| 708 |
&meta.universal_part(), &sideset); |
| 709 |
std::pair<bool,bool> freePolarity2 = stk::mesh::is_positive_sideset_face_polarity(*bulk, face, |
| 710 |
&meta.universal_part()); |
| 711 |
|
| 712 |
// Get polarity results with util wrapper code |
| 713 |
stk::mesh::PolarityUtil helper(*bulk, meta.universal_part()); |
| 714 |
std::pair<bool,bool> utilPolarity1 = helper.is_positive_sideset_polarity(*sidesetParts[1], face, &sideset); |
| 715 |
std::pair<bool,bool> utilPolarity2 = helper.is_positive_sideset_face_polarity(face); |
| 716 |
|
| 717 |
std::pair<bool,bool> expectedPolarity(true, true); |
| 718 |
|
| 719 |
EXPECT_EQ(expectedPolarity, freePolarity1); |
| 720 |
EXPECT_EQ(expectedPolarity, freePolarity2); |
| 721 |
|
| 722 |
EXPECT_EQ(expectedPolarity, utilPolarity1); |
| 723 |
EXPECT_EQ(expectedPolarity, utilPolarity2); |
| 724 |
} |
| 725 |
|
| 726 |
TEST(TestPolarity, oneParallelBoundaryBetweenTwoDifferentBlocks_withNoAura) |
| 727 |
{ |
| 728 |
stk::ParallelMachine comm = MPI_COMM_WORLD; |
| 729 |
|
| 730 |
if(stk::parallel_machine_size(comm) != 2) { |
| 731 |
GTEST_SKIP(); |
| 732 |
} |
| 733 |
|
| 734 |
run_one_parallel_boundary_polarity_test(comm, stk::mesh::BulkData::NO_AUTO_AURA); |
| 735 |
} |
| 736 |
|
| 737 |
TEST(TestPolarity, oneParallelBoundaryBetweenTwoDifferentBlocks_withAura) |
| 738 |
{ |
| 739 |
stk::ParallelMachine comm = MPI_COMM_WORLD; |
| 740 |
|
| 741 |
if(stk::parallel_machine_size(comm) != 2) { |
| 742 |
GTEST_SKIP(); |
| 743 |
} |
| 744 |
|
| 745 |
run_one_parallel_boundary_polarity_test(comm, stk::mesh::BulkData::AUTO_AURA); |
| 746 |
} |
| 747 |
|
| 748 |
void run_two_parallel_boundaries_polarity_test(stk::ParallelMachine comm, |
| 749 |
stk::mesh::BulkData::AutomaticAuraOption option) |
| 750 |
{ |
| 751 |
// Create bulk |
| 752 |
stk::mesh::MeshBuilder builder(comm); |
| 753 |
builder.set_spatial_dimension(3); |
| 754 |
builder.set_aura_option(option); |
| 755 |
std::shared_ptr<stk::mesh::BulkData> bulk = builder.create(); |
| 756 |
stk::mesh::MetaData &meta = bulk->mesh_meta_data(); |
| 757 |
|
| 758 |
// Register sideset updater |
| 759 |
if (!bulk->has_observer_type<stk::mesh::SidesetUpdater>()) { |
| 760 |
stk::mesh::Selector activeSelector = meta.universal_part(); |
| 761 |
|
| 762 |
bulk->register_observer(std::make_shared<stk::mesh::IncrementalSidesetUpdater>(*bulk, activeSelector)); |
| 763 |
} |
| 764 |
|
| 765 |
// Create sideset parts |
| 766 |
std::vector<std::string> sidesetNames{"surface_1", "surface_block_1_QUAD4_1"}; |
| 767 |
stk::mesh::PartVector sidesetParts; |
| 768 |
int sidesetId = 1; |
| 769 |
for(const std::string &name : sidesetNames) |
| 770 |
{ |
| 771 |
stk::mesh::Part &part = meta.declare_part_with_topology(name, stk::topology::QUAD_4); |
| 772 |
meta.set_part_id(part, sidesetId); |
| 773 |
sidesetParts.push_back(&part); |
| 774 |
} |
| 775 |
|
| 776 |
meta.declare_part_subset(*sidesetParts[0], *sidesetParts[1]); |
| 777 |
|
| 778 |
// Build mesh |
| 779 |
std::string meshDesc = "0,1,HEX_8, 1, 2, 3, 4, 5, 6, 7, 8,block_1\n" |
| 780 |
"1,2,HEX_8, 5, 6, 7, 8, 9,10,11,12,block_2\n" |
| 781 |
"0,3,HEX_8, 4, 3,14,13, 8, 7,16,15,block_1\n" |
| 782 |
"0,4,HEX_8, 8, 7,16,15,12,11,18,17,block_1" |
| 783 |
; |
| 784 |
std::vector<double> coordinates = { 0,0,0, 1,0,0, 1,1,0, 0,1,0, |
| 785 |
0,0,1, 1,0,1, 1,1,1, 0,1,1, |
| 786 |
0,0,2, 1,0,2, 1,1,2, 0,1,2, |
| 787 |
0,2,0, 1,2,0, 0,2,1, 1,2,1, |
| 788 |
0,2,2, 1,2,2}; |
| 789 |
|
| 790 |
bulk->initialize_face_adjacent_element_graph(); |
| 791 |
stk::unit_test_util::setup_text_mesh(*bulk, stk::unit_test_util::get_full_text_mesh_desc(meshDesc, coordinates)); |
| 792 |
|
| 793 |
// Create sideset |
| 794 |
stk::mesh::SideSet &sideset = bulk->create_sideset(*sidesetParts[0]); |
| 795 |
sideset.set_accept_all_internal_non_coincident_entries(false); |
| 796 |
|
| 797 |
// Populate sideset between elements 1 & 2, based on element 1 |
| 798 |
std::vector<stk::mesh::EntityId> elementIds_face1{1, 2}; |
| 799 |
std::vector<stk::mesh::ConnectivityOrdinal> elementOrdinals_face1{5, 4}; |
| 800 |
std::vector<stk::mesh::Entity> elements_face1(2); |
| 801 |
elements_face1[0] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds_face1[0]); |
| 802 |
elements_face1[1] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds_face1[1]); |
| 803 |
|
| 804 |
if (bulk->is_valid(elements_face1[0])) { |
| 805 |
sideset.add({elements_face1[0], elementOrdinals_face1[0]}); |
| 806 |
} |
| 807 |
|
| 808 |
// Populate sideset between elements 4 & 2, based on element 4 |
| 809 |
std::vector<stk::mesh::EntityId> elementIds_face2{4, 2}; |
| 810 |
std::vector<stk::mesh::ConnectivityOrdinal> elementOrdinals_face2{0, 2}; |
| 811 |
std::vector<stk::mesh::Entity> elements_face2(2); |
| 812 |
elements_face2[0] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds_face2[0]); |
| 813 |
elements_face2[1] = bulk->get_entity(stk::topology::ELEMENT_RANK, elementIds_face2[1]); |
| 814 |
|
| 815 |
if (bulk->is_valid(elements_face2[0])) { |
| 816 |
sideset.add({elements_face2[0], elementOrdinals_face2[0]}); |
| 817 |
} |
| 818 |
|
| 819 |
// Setup surface to block mapping for the sideset updater |
| 820 |
stk::mesh::Part* block_1 = meta.get_part("block_1"); |
| 821 |
EXPECT_TRUE(block_1 != nullptr); |
| 822 |
|
| 823 |
std::vector<const stk::mesh::Part*> touchingParts{block_1}; |
| 824 |
meta.set_surface_to_block_mapping(sidesetParts[1], touchingParts); |
| 825 |
|
| 826 |
// Create faces |
| 827 |
bulk->modification_begin(); |
| 828 |
int myProc = bulk->parallel_rank(); |
| 829 |
stk::mesh::Entity face1 = bulk->declare_element_side(elements_face1[myProc], elementOrdinals_face1[myProc], sidesetParts); |
| 830 |
stk::mesh::Entity face2 = bulk->declare_element_side(elements_face2[myProc], elementOrdinals_face2[myProc], sidesetParts); |
| 831 |
bulk->modification_end(); |
| 832 |
|
| 833 |
// Make sure there are only 2 global faces |
| 834 |
std::vector<size_t> counts; |
| 835 |
stk::mesh::comm_mesh_counts(*bulk, counts); |
| 836 |
EXPECT_EQ(2u, counts[meta.side_rank()]); |
| 837 |
|
| 838 |
// Make sure it matches the one we created |
| 839 |
stk::mesh::EntityVector faces; |
| 840 |
stk::mesh::get_selected_entities(meta.universal_part(), bulk->buckets(meta.side_rank()), faces); |
| 841 |
EXPECT_EQ(2u, faces.size()); |
| 842 |
EXPECT_EQ(face1, faces[0]); |
| 843 |
EXPECT_EQ(face2, faces[1]); |
| 844 |
|
| 845 |
{ |
| 846 |
// Get polarity results for face1 with free function code |
| 847 |
std::pair<bool,bool> freePolarity1 = stk::mesh::is_positive_sideset_polarity(*bulk, *sidesetParts[1], face1, |
| 848 |
&meta.universal_part(), &sideset); |
| 849 |
std::pair<bool,bool> freePolarity2 = stk::mesh::is_positive_sideset_face_polarity(*bulk, face1, |
| 850 |
&meta.universal_part()); |
| 851 |
|
| 852 |
// Get polarity results with util wrapper code |
| 853 |
stk::mesh::PolarityUtil helper(*bulk, meta.universal_part()); |
| 854 |
std::pair<bool,bool> utilPolarity1 = helper.is_positive_sideset_polarity(*sidesetParts[1], face1, &sideset); |
| 855 |
std::pair<bool,bool> utilPolarity2 = helper.is_positive_sideset_face_polarity(face1); |
| 856 |
|
| 857 |
std::pair<bool,bool> expectedPolarity(true, true); |
| 858 |
|
| 859 |
EXPECT_EQ(expectedPolarity, freePolarity1); |
| 860 |
EXPECT_EQ(expectedPolarity, freePolarity2); |
| 861 |
|
| 862 |
EXPECT_EQ(expectedPolarity, utilPolarity1); |
| 863 |
EXPECT_EQ(expectedPolarity, utilPolarity2); |
| 864 |
} |
| 865 |
|
| 866 |
{ |
| 867 |
// Get polarity results for face2 with free function code |
| 868 |
std::pair<bool,bool> freePolarity1 = stk::mesh::is_positive_sideset_polarity(*bulk, *sidesetParts[1], face2, |
| 869 |
&meta.universal_part(), &sideset); |
| 870 |
std::pair<bool,bool> freePolarity2 = stk::mesh::is_positive_sideset_face_polarity(*bulk, face2, |
| 871 |
&meta.universal_part()); |
| 872 |
|
| 873 |
// Get polarity results with util wrapper code |
| 874 |
stk::mesh::PolarityUtil helper(*bulk, meta.universal_part()); |
| 875 |
std::pair<bool,bool> utilPolarity1 = helper.is_positive_sideset_polarity(*sidesetParts[1], face2, &sideset); |
| 876 |
std::pair<bool,bool> utilPolarity2 = helper.is_positive_sideset_face_polarity(face2); |
| 877 |
|
| 878 |
std::pair<bool,bool> expectedPolarity(true, false); |
| 879 |
|
| 880 |
EXPECT_EQ(expectedPolarity, freePolarity1); |
| 881 |
EXPECT_EQ(expectedPolarity, freePolarity2); |
| 882 |
|
| 883 |
EXPECT_EQ(expectedPolarity, utilPolarity1); |
| 884 |
EXPECT_EQ(expectedPolarity, utilPolarity2); |
| 885 |
} |
| 886 |
} |
| 887 |
|
| 888 |
TEST(TestPolarity, twoParallelBoundariesBetweenTwoDifferentBlocks_withNoAura) |
| 889 |
{ |
| 890 |
stk::ParallelMachine comm = MPI_COMM_WORLD; |
| 891 |
|
| 892 |
if(stk::parallel_machine_size(comm) != 2) { |
| 893 |
GTEST_SKIP(); |
| 894 |
} |
| 895 |
|
| 896 |
run_two_parallel_boundaries_polarity_test(comm, stk::mesh::BulkData::NO_AUTO_AURA); |
| 897 |
} |
| 898 |
|
| 899 |
TEST(TestPolarity, twoParallelBoundariesBetweenTwoDifferentBlocks_withAura) |
| 900 |
{ |
| 901 |
stk::ParallelMachine comm = MPI_COMM_WORLD; |
| 902 |
|
| 903 |
if(stk::parallel_machine_size(comm) != 2) { |
| 904 |
GTEST_SKIP(); |
| 905 |
} |
| 906 |
|
| 907 |
run_two_parallel_boundaries_polarity_test(comm, stk::mesh::BulkData::AUTO_AURA); |
| 908 |
} |