changed: move ASMuSquare and ASMuCube to separate header

for reuse like in the structured ASMs tests
This commit is contained in:
Arne Morten Kvarving 2023-08-25 13:24:19 +02:00
parent 76a6139bfc
commit 9cf613cbca
4 changed files with 135 additions and 31 deletions

View File

@ -0,0 +1,76 @@
//==============================================================================
//!
//! \file ASMuCube.h
//!
//! \date Oct 2 2019
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Default tri-unit cube LR patch for unit-testing.
//!
//==============================================================================
#ifndef _ASM_UCUBE_H
#define _ASM_UCUBE_H
#include "ASMu3Dmx.h"
#include <sstream>
class ASMuCube : public ASMu3D
{
public:
// formatting matches write routine, do not change
static constexpr const char* cube =
"# LRSPLINE VOLUME\n"
"#\tp1\tp2\tp3\tNbasis\tNline\tNel\tdim\trat\n"
"\t2\t2\t2\t8\t6\t1\t3\t0\n"
"# Basis functions:\n"
"0: [0 0 1 ] x [0 0 1 ] x [0 0 1 ] 0 0 0 (1)\n"
"1: [0 1 1 ] x [0 0 1 ] x [0 0 1 ] 1 0 0 (1)\n"
"2: [0 0 1 ] x [0 1 1 ] x [0 0 1 ] 0 1 0 (1)\n"
"3: [0 1 1 ] x [0 1 1 ] x [0 0 1 ] 1 1 0 (1)\n"
"4: [0 0 1 ] x [0 0 1 ] x [0 1 1 ] 0 0 1 (1)\n"
"5: [0 1 1 ] x [0 0 1 ] x [0 1 1 ] 1 0 1 (1)\n"
"6: [0 0 1 ] x [0 1 1 ] x [0 1 1 ] 0 1 1 (1)\n"
"7: [0 1 1 ] x [0 1 1 ] x [0 1 1 ] 1 1 1 (1)\n"
"# Mesh rectangles:\n"
"[0, 0] x [0, 1] x [0, 1] (2)\n"
"[1, 1] x [0, 1] x [0, 1] (2)\n"
"[0, 1] x [0, 0] x [0, 1] (2)\n"
"[0, 1] x [1, 1] x [0, 1] (2)\n"
"[0, 1] x [0, 1] x [0, 0] (2)\n"
"[0, 1] x [0, 1] x [1, 1] (2)\n"
"# Elements:\n"
"0 [3] : (0, 0, 0) x (1, 1, 1) {0, 1, 2, 3, 4, 5, 6, 7}\n";
explicit ASMuCube(unsigned char n_f = 3) : ASMu3D(n_f)
{
std::stringstream geo("700 1 0 0\n3 0\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"0 0 0\n1 0 0\n0 1 0\n1 1 0\n"
"0 0 1\n1 0 1\n0 1 1\n1 1 1\n");
this->read(geo);
}
virtual ~ASMuCube() {}
};
class ASMmxuCube : public ASMu3Dmx
{
public:
explicit ASMmxuCube(const CharVec& n_f) : ASMu3Dmx(n_f)
{
std::stringstream geo("700 1 0 0\n3 0\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"0 0 0\n1 0 0\n0 1 0\n1 1 0\n"
"0 0 1\n1 0 1\n0 1 1\n1 1 1\n");
this->read(geo);
}
virtual ~ASMmxuCube() {}
};
#endif

View File

@ -0,0 +1,57 @@
//==============================================================================
//!
//! \file ASMuSquare.h
//!
//! \date Oct 2 2019
//!
//! \author Knut Morten Okstad / SINTEF
//!
//! \brief Default bi-unit square LR patch for unit-testing.
//!
//==============================================================================
#ifndef ASM_USQUARE_H
#define ASM_USQUARE_H
#include "ASMu2Dmx.h"
#include <sstream>
class ASMuSquare : public ASMu2D
{
public:
static constexpr const char* square =
"# LRSPLINE SURFACE\n"
"#\tp1\tp2\tNbasis\tNline\tNel\tdim\trat\n"
"\t2\t2\t4\t4\t1\t2\t0\n"
"# Basis functions:\n"
"0: [0 0 1 ] x [0 0 1 ] 0 0 (1)\n"
"1: [0 1 1 ] x [0 0 1 ] 1 0 (1)\n"
"2: [0 0 1 ] x [0 1 1 ] 0 1 (1)\n"
"3: [0 1 1 ] x [0 1 1 ] 1 1 (1)\n"
"# Mesh lines:\n0 x [0, 1] (2)\n"
"1 x [0, 1] (2)\n"
"[0, 1] x 0 (2)\n"
"[0, 1] x 1 (2)\n"
"# Elements:\n"
"0 [2] : (0, 0) x (1, 1) {0, 1, 2, 3}\n";
explicit ASMuSquare()
{
std::stringstream geo("200 1 0 0\n2 0\n2 2\n0 0 1 1\n2 2\n0 0 1 1\n0 0\n1 0\n0 1\n1 1\n");
this->read(geo);
}
virtual ~ASMuSquare() {}
};
class ASMmxuSquare : public ASMu2Dmx
{
public:
explicit ASMmxuSquare(const CharVec& n_f) : ASMu2Dmx(2,n_f)
{
std::stringstream geo("200 1 0 0\n2 0\n2 2\n0 0 1 1\n2 2\n0 0 1 1\n0 0\n1 0\n0 1\n1 1\n");
this->read(geo);
}
virtual ~ASMmxuSquare() {}
};
#endif

View File

@ -10,7 +10,7 @@
//!
//==============================================================================
#include "ASMu2D.h"
#include "ASMuSquare.h"
#include "ASMs2D.h"
#include "GaussQuadrature.h"
#include "SIM2D.h"
@ -262,18 +262,6 @@ TEST(TestASMu2D, Connect)
}
class ASMuSquare : public ASMu2D
{
public:
ASMuSquare()
{
std::stringstream geo("200 1 0 0\n2 0\n2 2\n0 0 1 1\n2 2\n0 0 1 1\n0 0\n1 0\n0 1\n1 1\n");
EXPECT_TRUE(this->read(geo));
}
virtual ~ASMuSquare() {}
};
TEST(TestASMu2D, ElementConnectivities)
{
ASMuSquare pch1;

View File

@ -10,7 +10,7 @@
//!
//==============================================================================
#include "ASMu3D.h"
#include "ASMuCube.h"
#include "SIM3D.h"
#include "GaussQuadrature.h"
#include "LRSpline/LRSplineVolume.h"
@ -90,23 +90,6 @@ INSTANTIATE_TEST_CASE_P(TestASMu3D,
testing::ValuesIn(tests));
class ASMuCube : public ASMu3D
{
public:
ASMuCube()
{
std::stringstream geo("700 1 0 0\n3 0\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"2 2\n0 0 1 1\n"
"0 0 0\n1 0 0\n0 1 0\n1 1 0\n"
"0 0 1\n1 0 1\n0 1 1\n1 1 1\n");
EXPECT_TRUE(this->read(geo));
}
virtual ~ASMuCube() {}
};
TEST(TestASMu3D, TransferGaussPtVars)
{
ASMuCube pch;