Skip to content

Commit

Permalink
add test cases for 2D/3D connections
Browse files Browse the repository at this point in the history
in particular for uneven face sizes (ie n1 != n2)
  • Loading branch information
akva2 authored and VikingScientist committed Feb 15, 2018
1 parent 67458a9 commit 7d04801
Show file tree
Hide file tree
Showing 30 changed files with 2,114 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/ASM/LR/Test/TestASMu2D.C
Original file line number Diff line number Diff line change
Expand Up @@ -224,3 +224,17 @@ TEST(TestASMu2D, TransferGaussPtVarsN)
for (size_t i = 0; i < refAr.size(); ++i)
EXPECT_FLOAT_EQ(refAr[i], newAr[i]);
}


TEST(TestASMu2D, Connect)
{
SIM2D sim(1);
sim.opt.discretization = ASM::LRSpline;
ASSERT_TRUE(sim.read("src/ASM/Test/refdata/DomainDecomposition_MPI_2D_4_orient0.xinp"));
ASSERT_TRUE(sim.createFEMmodel());

SIM2D sim2(1);
sim2.opt.discretization = ASM::LRSpline;
ASSERT_TRUE(sim2.read("src/ASM/Test/refdata/DomainDecomposition_MPI_2D_4_orient1.xinp"));
ASSERT_TRUE(sim2.createFEMmodel());
}
34 changes: 33 additions & 1 deletion src/ASM/LR/Test/TestASMu3D.C
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ class TestASMu3D :

TEST_P(TestASMu3D, BoundaryNodes)
{
if (GetParam() == 0 || GetParam() > 6)
return;

SIM3D sim(1);
sim.opt.discretization = ASM::LRSpline;
ASSERT_TRUE(sim.read("src/ASM/LR/Test/refdata/boundary_nodes_3d.xinp"));
Expand Down Expand Up @@ -58,7 +61,36 @@ TEST_P(TestASMu3D, BoundaryNodes)
}


const std::vector<int> tests = {1,2,3,4,5,6};
TEST_P(TestASMu3D, Connect)
{
if (GetParam() > 7)
return;

SIM3D sim(3);
sim.opt.discretization = ASM::LRSpline;
std::stringstream str;
str << "src/ASM/Test/refdata/DomainDecomposition_MPI_3D_4_orient";
str << GetParam() << ".xinp";
ASSERT_TRUE(sim.read(str.str().c_str()));
ASSERT_TRUE(sim.createFEMmodel());
}


TEST_P(TestASMu3D, ConnectUneven)
{
SIM3D sim(1);
sim.opt.discretization = ASM::LRSpline;
std::stringstream str;
str << "src/ASM/Test/refdata/3d_uneven";
if (GetParam() > 0)
str << "_" << (GetParam()-1)/3 << (GetParam()-1) % 3;
str << ".xinp";
ASSERT_TRUE(sim.read(str.str().c_str()));
ASSERT_TRUE(sim.createFEMmodel());
}


const std::vector<int> tests = {0,1,2,3,4,5,6,7,8,9,10,11,12};
INSTANTIATE_TEST_CASE_P(TestASMu3D,
TestASMu3D,
testing::ValuesIn(tests));
Expand Down
37 changes: 37 additions & 0 deletions src/ASM/Test/TestASMs2D.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
//==============================================================================
//!
//! \file TestASMs2D.C
//!
//! \date Feb 14 2018
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Tests for structured 2D spline FE models.
//!
//==============================================================================

#include "ASMs2D.h"
#include "SIM2D.h"

#include "gtest/gtest.h"
#include <numeric>


class TestASMs2D : public testing::Test,
public testing::WithParamInterface<int>
{
};


TEST_P(TestASMs2D, Connect)
{
SIM2D sim(1);
std::stringstream str;
str << "src/ASM/Test/refdata/DomainDecomposition_MPI_2D_4_orient";
str << GetParam() << ".xinp";
ASSERT_TRUE(sim.read(str.str().c_str()));
ASSERT_TRUE(sim.createFEMmodel());
}

const std::vector<int> orientations2D = {0,1};
INSTANTIATE_TEST_CASE_P(TestASMs2D, TestASMs2D, testing::ValuesIn(orientations2D));
54 changes: 54 additions & 0 deletions src/ASM/Test/TestASMs3D.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
//==============================================================================
//!
//! \file TestASMs3D.C
//!
//! \date Feb 14 2018
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Tests for structured 3D spline FE models.
//!
//==============================================================================

#include "ASMs3D.h"
#include "SIM3D.h"

#include "gtest/gtest.h"
#include <numeric>


class TestASMs3D : public testing::Test,
public testing::WithParamInterface<int>
{
};


TEST_P(TestASMs3D, Connect)
{
if (GetParam() > 7)
return;

SIM3D sim(3);
std::stringstream str;
str << "src/ASM/Test/refdata/DomainDecomposition_MPI_3D_4_orient";
str << GetParam() << ".xinp";
ASSERT_TRUE(sim.read(str.str().c_str()));
ASSERT_TRUE(sim.createFEMmodel());
}


TEST_P(TestASMs3D, ConnectUneven)
{
SIM3D sim(1);
std::stringstream str;
str << "src/ASM/Test/refdata/3d_uneven";
if (GetParam() > 0)
str << "_" << (GetParam()-1)/3 << (GetParam()-1) % 3;
str << ".xinp";
ASSERT_TRUE(sim.read(str.str().c_str()));
ASSERT_TRUE(sim.createFEMmodel());
}


const std::vector<int> orientations3D = {0,1,2,3,5,6,7,8,9,10,11,12};
INSTANTIATE_TEST_CASE_P(TestASMs3D, TestASMs3D, testing::ValuesIn(orientations3D));
142 changes: 142 additions & 0 deletions src/ASM/Test/refdata/3d_uneven.g2
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
700 1 0 0
3 0
3 3
0.000000 0.000000 0.000000 1.000000 1.000000 1.000000
3 3
0.000000 0.000000 0.000000 1.000000 1.000000 1.000000
6 3
0.000000 0.000000 0.000000 0.250000 0.500000 0.750000 1.000000 1.000000 1.000000
41.635010 -90.713995 4.776597
41.687109 -90.698896 4.767501
41.739207 -90.683798 4.758404
41.661990 -90.734922 4.896388
41.714089 -90.719823 4.887292
41.766187 -90.704725 4.878196
41.694023 -90.848865 4.890723
41.746122 -90.833766 4.881627
41.798220 -90.818668 4.872530
41.665780 -90.842315 4.739839
41.717879 -90.827216 4.730743
41.769978 -90.812117 4.721647
41.691291 -90.860857 4.855174
41.743390 -90.845758 4.846077
41.795488 -90.830659 4.836981
41.721223 -90.960787 4.860734
41.773322 -90.945689 4.851637
41.825420 -90.930590 4.842541
41.727321 -91.098954 4.666324
41.779420 -91.083856 4.657228
41.831519 -91.068757 4.648131
41.749893 -91.112726 4.772745
41.801992 -91.097627 4.763648
41.854091 -91.082528 4.754552
41.775623 -91.184632 4.800755
41.827722 -91.169533 4.791658
41.879820 -91.154435 4.782562
41.788862 -91.355594 4.592809
41.840961 -91.340495 4.583713
41.893060 -91.325397 4.574616
41.808495 -91.364595 4.690316
41.860594 -91.349496 4.681219
41.912693 -91.334398 4.672123
41.830023 -91.408477 4.740776
41.882122 -91.393378 4.731680
41.934220 -91.378279 4.722583
41.850403 -91.612234 4.519294
41.902502 -91.597135 4.510198
41.954601 -91.582036 4.501101
41.867097 -91.616464 4.607887
41.919196 -91.601365 4.598790
41.971295 -91.586267 4.589694
41.884423 -91.632322 4.680797
41.936522 -91.617223 4.671701
41.988620 -91.602124 4.662605
41.881174 -91.740554 4.482537
41.933272 -91.725455 4.473440
41.985371 -91.710356 4.464344
41.896398 -91.742399 4.566672
41.948497 -91.727300 4.557576
42.000596 -91.712201 4.548479
41.911623 -91.744244 4.650808
41.963722 -91.729145 4.641712
42.015820 -91.714047 4.632615
700 1 0 0
3 0
6 3
0.000000 0.000000 0.000000 0.250000 0.500000 0.750000 1.000000 1.000000 1.000000
3 3
0.000000 0.000000 0.000000 1.000000 1.000000 1.000000
4 3
0.000000 0.000000 0.000000 0.500000 1.000000 1.000000 1.000000
41.511457 -90.537331 4.362204
41.547338 -90.678900 4.332724
41.619100 -90.962037 4.273764
41.690861 -91.245174 4.214805
41.762623 -91.528311 4.155845
41.798504 -91.669880 4.126365
41.567949 -90.528514 4.367843
41.603714 -90.669685 4.338359
41.675243 -90.952026 4.279389
41.746772 -91.234366 4.220419
41.818301 -91.516707 4.161449
41.854066 -91.657878 4.131964
41.624442 -90.519698 4.373483
41.660090 -90.660470 4.343993
41.731387 -90.942014 4.285013
41.802683 -91.223559 4.226034
41.873980 -91.505103 4.167054
41.909628 -91.645875 4.137564
41.542345 -90.581497 4.465802
41.576949 -90.719753 4.434503
41.646155 -90.996266 4.371904
41.715362 -91.272779 4.309306
41.784568 -91.549292 4.246707
41.819171 -91.687548 4.215408
41.597739 -90.571110 4.467758
41.632255 -90.709068 4.436455
41.701287 -90.984983 4.373849
41.770319 -91.260899 4.311243
41.839352 -91.536814 4.248636
41.873868 -91.674772 4.217333
41.653133 -90.560723 4.469713
41.687562 -90.698382 4.438406
41.756420 -90.973700 4.375793
41.825277 -91.249018 4.313179
41.894135 -91.524336 4.250566
41.928564 -91.661995 4.219259
41.604122 -90.669829 4.672999
41.636170 -90.801461 4.638061
41.700266 -91.064725 4.568184
41.764362 -91.327989 4.498308
41.828458 -91.591253 4.428432
41.860506 -91.722885 4.393494
41.657319 -90.656301 4.667586
41.689338 -90.787833 4.632647
41.753376 -91.050898 4.562768
41.817414 -91.313963 4.492889
41.881452 -91.577028 4.423011
41.913471 -91.708561 4.388071
41.710516 -90.642773 4.662174
41.742506 -90.774206 4.627233
41.806486 -91.037071 4.557352
41.870466 -91.299937 4.487471
41.934445 -91.562803 4.417589
41.966435 -91.694236 4.382649
41.635010 -90.713995 4.776597
41.665780 -90.842315 4.739839
41.727321 -91.098954 4.666324
41.788862 -91.355594 4.592809
41.850403 -91.612234 4.519294
41.881174 -91.740554 4.482537
41.687109 -90.698896 4.767501
41.717879 -90.827216 4.730743
41.779420 -91.083856 4.657228
41.840961 -91.340495 4.583713
41.902502 -91.597135 4.510198
41.933272 -91.725455 4.473440
41.739207 -90.683798 4.758404
41.769978 -90.812117 4.721647
41.831519 -91.068757 4.648131
41.893060 -91.325397 4.574616
41.954601 -91.582036 4.501101
41.985371 -91.710356 4.464344
10 changes: 10 additions & 0 deletions src/ASM/Test/refdata/3d_uneven.xinp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>

<simulation>
<geometry>
<patchfile>src/ASM/Test/refdata/3d_uneven.g2</patchfile>
<topology>
<connection master="1" mface="3" slave="2" sface="6" orient="4"/>
</topology>
</geometry>
</simulation>
Loading

0 comments on commit 7d04801

Please sign in to comment.