added: SIMNodalConstraint

this is a wrapper for SIMxD which equips it with the
ability to constrain a dof on a patch / face / edge / vertex
to the same dof in a given vertex.

useful for applying rigid body motion to parts of a model.
This commit is contained in:
Arne Morten Kvarving
2015-12-09 10:51:52 +01:00
committed by Knut Morten Okstad
parent 407b9e9bbc
commit b725819af4
42 changed files with 1995 additions and 0 deletions

View File

@@ -36,6 +36,7 @@ ADD_LIBRARY(CommonIFEM MeshUtils.C
ResidualOperators.C
Spalding.C
SAWallLaw.C
SIMNodalConstraint.C
StabilizationUtils.C
TimeIntUtils.C
WeakOperators.C)

View File

@@ -0,0 +1,432 @@
// $Id$
//==============================================================================
//!
//! \file SIMNodalConstraint.C
//!
//! \date Nov 4 2015
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Base class for simulators constraining a topologyset to a given node.
//!
//==============================================================================
#include "SIMNodalConstraint.h"
#include "ASMs1D.h"
#include "ASMs2D.h"
#ifdef HAS_LRSPLINE
#include "ASMu2D.h"
#endif
#include "ASMs3D.h"
//! \brief Helper for applying operation to different ASM types
class NodalConstraintASMHelper {
public:
//! \brief Constructor
//! \param pch The associated ASM class
NodalConstraintASMHelper(ASMbase* pch) :
bpch(pch)
{}
//! \brief Empty destructor
virtual ~NodalConstraintASMHelper() {}
//! \brief Obtain the global node number of a given corner node on patch.
//! \param vertex Vertex to obtain
//! \param basis Basis for vertex
virtual int getCorner(int vertex, int basis) = 0;
//! \brief Constrain a given edge to a given node.
//! \param item Edge index on patch
//! \param comp Component to constrain
//! \param basis Basis to constrain edge for
//! \param idx Global node to constrain edge to.
virtual void constrainEdge(int item, int comp, int basis, int idx) = 0;
//! \brief Constrain a given vertex to a given node.
//! \param item item Vertex index on patch.
//! \param comp Component to constrain
//! \param basis Basis to constrain vertex for.
//! \param idx Global node to constrain edge to.
void constrainVertex(int item, int comp, int basis, int idx)
{
int gn = bpch->getNodeID(getCorner(item, basis));
if (gn != idx)
bpch->add2PC(gn, comp, idx);
}
//! \brief Constrain the patch to a given node.
//! \param[in] comp Component to constrain
//! \param[in] basis Basis to constrain vertex for.
//! \param[in] idx Global node to constrain patch to.
void constrainPatch(int comp, int basis, int idx)
{
size_t ofs = getStartNode(basis);
for (size_t i = 1; i <= bpch->getNoNodes(basis); ++i) {
int gn = bpch->getNodeID(ofs+i);
if (gn != idx)
bpch->add2PC(bpch->getNodeID(ofs+i), comp, idx);
}
}
//! \brief Obtain the starting node for a given basis.
//! \param[in] basis Basis to obtain the starting node for
size_t getStartNode(size_t basis)
{
size_t ofs = 0;
for (size_t i=1;i<basis;++i)
ofs += bpch->getNoNodes(i);
return ofs;
}
protected:
ASMbase* bpch; //!< ASMbase pointer to associated patch
};
//! \brief Helper for apply constraints to a structured 1D model.
class NodalConstraintASMs1DHelper : public NodalConstraintASMHelper {
public:
//! \brief Constructor
//! \param pch The associated ASM class
NodalConstraintASMs1DHelper(ASMs1D* spch) :
NodalConstraintASMHelper(spch), pch(spch)
{}
//! \brief Obtain the global node number of a given corner node on patch.
//! \param vertex Vertex to obtain
//! \param basis Basis for vertex
int getCorner(int vertex, int basis)
{
size_t ofs = getStartNode(basis);
return pch->getNodeID(ofs+(vertex==1?1:pch->getSize(basis)));
}
//! \brief Constrain a given edge to a given node.
//! \param item Edge index on patch
//! \param comp Component to constrain
//! \param basis Basis to constrain edge for
//! \param idx Global node to constrain edge to.
void constrainEdge(int item, int comp, int basis, int idx) {}
protected:
ASMs1D* pch; //!< The associated patch.
};
//! \brief Helper for apply constraints to a structured 2D model.
class NodalConstraintASMs2DHelper : public NodalConstraintASMHelper {
public:
//! \brief Constructor
//! \param pch The associated ASM class
NodalConstraintASMs2DHelper(ASMs2D* spch) :
NodalConstraintASMHelper(spch), pch(spch)
{}
//! \copydoc NodalConstrainASM2DHelper::getCorner
int getCorner(int vertex, int basis)
{
int n1, n2;
pch->getSize(n1, n2, basis);
size_t ofs = getStartNode(basis);
const std::vector<int> idxs = {1, n1, n1*(n2-1)+1, n1*n2};
return pch->getNodeID(idxs[vertex-1]+ofs);
}
//! \copydoc NodalConstrainASM2DHelper::constrainEdge
void constrainEdge(int item, int comp, int basis, int idx)
{
size_t ofs = getStartNode(basis);
int n1, n2, node = 1;
pch->getSize(n1,n2,basis);
switch (item) {
case 2: // Right edge (positive I-direction)
node += n1-1;
case 1: // Left edge (negative I-direction)
for (int i2 = 1; i2 <= n2; i2++, node += n1) {
int gn = pch->getNodeID(ofs+node);
if (gn != idx)
pch->add2PC(pch->getNodeID(ofs+node), comp, idx);
}
break;
case 4: // Back edge (positive J-direction)
node += n1*(n2-1);
case 3: // Front edge (negative J-direction)
for (int i1 = 1; i1 <= n1; i1++, node++) {
int gn = pch->getNodeID(ofs+node);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
default:
break;
}
}
protected:
ASMs2D* pch; //!< The associated patch.
};
//! \brief Helper for apply constraints to a structured 3D model.
class NodalConstraintASMs3DHelper : public NodalConstraintASMHelper {
public:
//! \brief Constructor
//! \param spch The associated patch
NodalConstraintASMs3DHelper(ASMs3D* spch) :
NodalConstraintASMHelper(spch), pch(spch) {}
//! \copydoc NodalConstraintASMHelper::getCorner
int getCorner(int vertex, int basis)
{
size_t ofs = getStartNode(basis);
int n1, n2, n3;
pch->getSize(n1, n2, n3, basis);
int ofs_j = n1*(n2-1);
int ofs_k = n1*n2*(n3-1);
const std::vector<int> idxs = { 1, n1,
ofs_j+1, ofs_j+n1,
ofs_k+1, ofs_k+n1,
ofs_k+ofs_j+1, ofs_k+ofs_j+n1};
return pch->getNodeID(idxs[vertex-1]+ofs);
}
//! \copydoc NodalConstrainASMHelper::constrainEdge
void constrainEdge(int item, int comp, int basis, int idx)
{
size_t node = getStartNode(basis)+1;
int n1, n2, n3;
pch->getSize(n1,n2,n3,basis);
size_t inc = 1;
int n;
if (item > 8) {
inc = n1*n2;
n = n3;
} else if (item > 4) {
inc = n1;
n = n2;
} else
n = n1;
switch (item)
{
case 6:
case 10:
node += n1 - 1;
break;
case 2:
case 11:
node += n1*(n2-1);
break;
case 12:
node += n1*n2 - 1;
break;
case 3:
case 7:
node += n1*n2*(n3-1);
break;
case 8:
node += n1*(n2*(n3-1) + 1) - 1;
break;
case 4:
node += n1*(n2*n3-1);
break;
}
for (int i = 1; i <= n; i++, node += inc) {
int gn = pch->getNodeID(node);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
}
//! \brief Constrain a given face to a given node.
//! \param item Face index on patch
//! \param comp Component to constrain
//! \param basis Basis to constrain edge for
//! \param idx Global node to constrain edge to.
void constrainFace(int item, int comp, int basis, int idx)
{
int node = getStartNode(basis)+1;
int n1, n2, n3;
pch->getSize(n1,n2,n3,basis);
const std::vector<int> faceDir = {-1, 1, -2, 2, -3, 3};
switch (faceDir[item-1])
{
case 1: // Right face (positive I-direction)
node += n1-1;
case -1: // Left face (negative I-direction)
for (int i3 = 1; i3 <= n3; i3++)
for (int i2 = 1; i2 <= n2; i2++, node += n1) {
int gn = pch->getNodeID(node);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
break;
case 2: // Back face (positive J-direction)
node += n1*(n2-1);
case -2: // Front face (negative J-direction)
for (int i3 = 1; i3 <= n3; i3++, node += n1*(n2-1))
for (int i1 = 1; i1 <= n1; i1++, node++) {
int gn = pch->getNodeID(node);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
break;
case 3: // Top face (positive K-direction)
node += n1*n2*(n3-1);
case -3: // Bottom face (negative K-direction)
for (int i2 = 1; i2 <= n2; i2++)
for (int i1 = 1; i1 <= n1; i1++, node++) {
int gn = pch->getNodeID(node);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
break;
}
}
protected:
ASMs3D* pch; //!< The associated patch.
};
#ifdef HAS_LRSPLINE
class NodalConstraintASMu2DHelper : public NodalConstraintASMHelper {
public:
//! \brief Constructor
//! \param upch Associated patch
NodalConstraintASMu2DHelper(ASMu2D* upch) :
NodalConstraintASMHelper(upch), pch(upch) {}
//! \copydoc NodalConstraintASM2DHelper::getCorner
int getCorner(int vertex, int basis)
{
static const int indices[4][2] = {{-1,-1}, {1, -1}, {-1, 1}, {1,1}};
size_t ofs = getStartNode(basis);
return ofs + pch->getCorner(indices[vertex-1][0], indices[vertex-1][1], basis);
}
//! \copydoc NodalConstraintASM2DHelper::constrainEdge
void constrainEdge(int item, int comp, int basis, int idx)
{
std::vector<int> map = {-1, 1, -2, 2};
std::vector<int> nodes = pch->getEdgeNodes(map[item-1], basis);
for (auto& it : nodes) {
int gn = pch->getNodeID(it);
if (gn != idx)
pch->add2PC(gn, comp, idx);
}
}
protected:
ASMu2D* pch; //!< The associated patch.
};
#endif
template<>
void NodalConstraintProcessor<SIM1D>::apply(SIM1D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr)
{
for (const auto& it3 : vConstr) {
TopologySet::const_iterator it = myEntitys.find(it3.topset);
if (it != myEntitys.end()) {
ASMs1D* pch = static_cast<ASMs1D*>(sim.getPatch(it3.patch));
if (!pch)
continue;
NodalConstraintASMs1DHelper helper(pch);
int idx = pch->getNodeID(helper.getCorner(it3.vertex, it3.basis));
for (const auto& it2 : it->second) {
// vertex constraints
ASMs1D* pch2 = static_cast<ASMs1D*>(sim.getPatch(it2.patch));
if (!pch2)
continue;
NodalConstraintASMs1DHelper helper2(pch2);
if (it2.idim == 1)
helper2.constrainPatch(it3.comp, it3.basis, idx);
else if (it2.idim == 0)
helper.constrainVertex(it2.item, it3.comp, it3.basis, idx);
}
}
}
}
static NodalConstraintASMHelper* get2DHelper(ASMbase* pch)
{
ASMs2D* spch = dynamic_cast<ASMs2D*>(pch);
if (spch)
return new NodalConstraintASMs2DHelper(spch);
#ifdef HAS_LRSPLINE
else {
ASMu2D* upch = dynamic_cast<ASMu2D*>(pch);
if (upch)
return new NodalConstraintASMu2DHelper(upch);
}
#endif
return nullptr;
}
template<>
void NodalConstraintProcessor<SIM2D>::apply(SIM2D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr)
{
for (const auto& it3 : vConstr) {
TopologySet::const_iterator it = myEntitys.find(it3.topset);
if (it != myEntitys.end()) {
std::unique_ptr<NodalConstraintASMHelper> helper(get2DHelper(sim.getPatch(it3.patch)));
int idx = helper->getCorner(it3.vertex, it3.basis);
for (const auto& it2 : it->second) {
std::unique_ptr<NodalConstraintASMHelper> helper2(get2DHelper(sim.getPatch(it2.patch)));
if (it2.idim == 2)
helper2->constrainPatch(it3.comp, it3.basis, idx);
else if (it2.idim == 1) // Edge constraints
helper2->constrainEdge(it2.item, it3.comp, it3.basis, idx);
else if (it2.idim == 0) // Vertex constraint
helper2->constrainVertex(it2.item, it3.comp, it3.basis, idx);
}
}
}
}
template<>
void NodalConstraintProcessor<SIM3D>::apply(SIM3D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr)
{
for (const auto& it3 : vConstr) {
TopologySet::const_iterator it = myEntitys.find(it3.topset);
if (it != myEntitys.end()) {
ASMs3D* pch = static_cast<ASMs3D*>(sim.getPatch(it3.patch));
if (!pch)
continue;
NodalConstraintASMs3DHelper helper(pch);
int idx = helper.getCorner(it3.vertex, it3.basis);
for (const auto& it2 : it->second) {
// vertex constraints
ASMs3D* pch2 = static_cast<ASMs3D*>(sim.getPatch(it2.patch));
if (!pch2)
continue;
NodalConstraintASMs3DHelper helper2(pch2);
if (it2.idim == 3)
helper2.constrainPatch(it3.comp, it3.basis, idx);
else if (it2.idim == 2) // Face constraints
helper2.constrainFace(it2.item, it3.comp, it3.basis, idx);
else if (it2.idim == 1) // Edge constraints
helper2.constrainEdge(it2.item, it3.comp, it3.basis, idx);
else if (it2.idim == 0) // Vertex constraint
helper2.constrainVertex(it2.item, it3.comp, it3.basis, idx);
}
}
}
}

View File

@@ -0,0 +1,124 @@
// $Id$
//==============================================================================
//!
//! \file SIMNodalConstraint.h
//!
//! \date Nov 4 2015
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Base class for simulators constraining a topologyset to a given node.
//!
//==============================================================================
#ifndef _SIM_NODALCONSTRAINT_H_
#define _SIM_NODALCONSTRAINT_H_
#include "IFEM.h"
#include "SIM1D.h"
#include "SIM2D.h"
#include "SIM3D.h"
#include "Utilities.h"
#include "tinyxml.h"
class ASMbase;
class ASMs1D;
class ASMs2D;
class ASMs3D;
class ASMu2D;
//! \brief Describes a topologyset constrained to a vertex.
struct TopSetToVertex {
std::string topset; //!< Topologyset to be constrained
size_t basis; //!< Basis to constrain
size_t patch; //!< Patch number of vertex
size_t vertex; //!< Vertex number
size_t comp; //!< Component to constrain
//! \brief Default constructor.
TopSetToVertex() : basis(1), patch(1), vertex(1), comp(1) {}
};
//! \brief Helper class for constraining entities to a node
template<class Dim>
class NodalConstraintProcessor {
public:
//! \brief Convenience typedef
typedef std::vector<TopSetToVertex> ConstraintVec;
//! \brief Apply nodal constraints
//! \param sim The simulator to apply the constraints to
//! \param myEntitys The topologysets of the simulator
//! \param vertConstraints Constraints to apply
static void apply(Dim& sim, TopologySet& myEntitys,
const ConstraintVec& vertConstraints);
};
//! \brief Specialization for 1D
template<>
void NodalConstraintProcessor<SIM1D>::apply(SIM1D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr);
//! \brief Specialization for 2D
template<>
void NodalConstraintProcessor<SIM2D>::apply(SIM2D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr);
//! \brief Specialization for 3D
template<>
void NodalConstraintProcessor<SIM3D>::apply(SIM3D& sim, TopologySet& myEntitys,
const ConstraintVec& vConstr);
//! \brief Inherit this class to equip your SIM with nodal constraints.
template<class Dim>
class SIMNodalConstraint : public Dim {
public:
//! \brief Default constructor.
//! \param[in] n1 Dimension of the primary solution field
//! \param[in] check If \e true, ensure the model is in a right-hand system
SIMNodalConstraint(const SIMbase::CharVec& unf,
bool checkRHS=false) :
Dim(unf,checkRHS) {}
//! \brief Empty destructor
virtual ~SIMNodalConstraint() {}
//! \copydoc SIMbase::preprocessBeforeAsmInit(int&)
//! \details Sets up the nodal constraints.
virtual void preprocessBeforeAsmInit(int&)
{
NodalConstraintProcessor<Dim>::apply(*this, this->myEntitys,
vertConstraints);
}
//! \brief Parses a data section from an XML element.
virtual bool parse(const TiXmlElement* elem)
{
if (!strcasecmp(elem->Value(),"constraintovertex")) {
vertConstraints.resize(vertConstraints.size()+1);
utl::getAttribute(elem,"set",vertConstraints.back().topset);
utl::getAttribute(elem,"patch",vertConstraints.back().patch);
utl::getAttribute(elem,"vertex",vertConstraints.back().vertex);
utl::getAttribute(elem,"comp",vertConstraints.back().comp);
utl::getAttribute(elem,"basis",vertConstraints.back().basis);
IFEM::cout << "\tConstraining set \"" << vertConstraints.back().topset
<< "\" to P"<< vertConstraints.back().patch << "V"
<< vertConstraints.back().vertex
<< " in direction " << vertConstraints.back().comp;
if (vertConstraints.back().basis > 1)
IFEM::cout << " (basis " << vertConstraints.back().basis << ")";
IFEM::cout << std::endl;
} else
return this->Dim::parse(elem);
return true;
}
protected:
std::vector<TopSetToVertex> vertConstraints; //!< Registered vertex constraints
};
#endif

View File

@@ -0,0 +1,944 @@
//==============================================================================
//!
//! \file TestSIMNodalConstraint.C
//!
//! \date Nov 26 2015
//!
//! \author Arne Morten Kvarving / SINTEF
//!
//! \brief Tests for base class for simulators constraining a topologyset
//! to a given node.
//!
//==============================================================================
#include "SIMNodalConstraint.h"
#include "ASMbase.h"
#include "ASMs2D.h"
#ifdef HAS_LRSPLINE
#include "ASMu2D.h"
#endif
#include "ASMs2Dmx.h"
#include "ASMs3D.h"
#include "ASMs3Dmx.h"
#include "MPC.h"
#include "gtest/gtest.h"
auto&& check_mpc = [](MPC* mpc, int node)
{
ASSERT_TRUE(mpc != nullptr);
ASSERT_TRUE(mpc->getNoMaster() == 1);
ASSERT_TRUE(mpc->getMaster(0).node == node);
ASSERT_TRUE(mpc->getMaster(0).dof == 1);
};
TEST(TestSIMNodalConstraint, ASMs1DV1)
{
SIMNodalConstraint<SIM1D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_1D_V1.xinp"));
s.preprocess();
const ASMbase& pch = *s.getPatch(1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == 1)
check_mpc(pch.findMPC(i,1), pch.getNoNodes());
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs1DV2)
{
SIMNodalConstraint<SIM1D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_1D_V2.xinp"));
s.preprocess();
const ASMbase& pch = *s.getPatch(1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == pch.getNoNodes())
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DV1)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V1.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == 1)
check_mpc(pch.findMPC(i, 1), n1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DV2)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V2.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DV3)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V3.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1*(n2-1)+1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DV4)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V4.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == pch.getNoNodes())
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DE1)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E1.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % n1 == 1)
check_mpc(pch.findMPC(i, 1), n1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DE2)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E2.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % n1 == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DE3)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E3.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i <= (size_t)n1)
check_mpc(pch.findMPC(i, 1), n1*n2);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DE4)
{
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E4.xinp"));
s.preprocess();
const ASMs2D& pch = static_cast<const ASMs2D&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i > (size_t)n1*(n2-1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
#ifdef HAS_LRSPLINE
TEST(TestSIMNodalConstraint, ASMu2DV1)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V1.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == 1)
check_mpc(pch.findMPC(i, 1), pch.getCorner(1,-1,1));
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DV2)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V2.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)pch.getCorner(1,-1,1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DV3)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V3.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)pch.getCorner(-1,1,1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DV4)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_V4.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)pch.getCorner(1,1,1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DE1)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E1.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
auto nodes = pch.getEdgeNodes(-1, 1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (std::find(nodes.begin(), nodes.end(), i) != nodes.end() && i != (size_t)pch.getCorner(1,-1,1))
check_mpc(pch.findMPC(i, 1), pch.getCorner(1,-1,1));
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DE2)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E2.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
auto nodes = pch.getEdgeNodes(1, 1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (std::find(nodes.begin(), nodes.end(), i) != nodes.end())
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DE3)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E3.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
auto nodes = pch.getEdgeNodes(-2, 1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (std::find(nodes.begin(), nodes.end(), i) != nodes.end())
check_mpc(pch.findMPC(i, 1), pch.getCorner(1,1,1));
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DE4)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E4.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
auto nodes = pch.getEdgeNodes(2, 1);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (std::find(nodes.begin(), nodes.end(), i) != nodes.end())
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
TEST(TestSIMNodalConstraint, ASMu2DmxE3)
{
auto old = IFEM::getOptions().discretization;
IFEM::getOptions().discretization = ASM::LRSpline;
SIMNodalConstraint<SIM2D> s({2,2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E3_mixed.xinp"));
s.preprocess();
const ASMu2D& pch = static_cast<const ASMu2D&>(*s.getPatch(1));
auto nodes = pch.getEdgeNodes(-2, 2);
size_t ofs = pch.getNoNodes(1);
for (size_t i=1; i <= pch.getNoNodes(1); ++i) {
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
for (size_t i=1; i <= pch.getNoNodes(2); ++i) {
if (std::find(nodes.begin(), nodes.end(), i+ofs) != nodes.end())
check_mpc(pch.findMPC(i+ofs, 1), ofs+pch.getCorner(1,1,2));
else
ASSERT_TRUE(pch.findMPC(i+ofs, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i+ofs, 2) == nullptr);
}
IFEM::getOptions().discretization = old;
}
#endif
TEST(TestSIMNodalConstraint, ASMs3DV1)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V1.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == 1)
check_mpc(pch.findMPC(i, 1), n1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV2)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V2.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV3)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V3.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1*(n2-1)+1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV4)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V4.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1*n2)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV5)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V5.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)1+n1*n2*(n3-1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV6)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V6.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)n1+n1*n2*(n3-1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV7)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V7.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == (size_t)1+n1*(n2-1)+n1*n2*(n3-1))
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DV8)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_V8.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i == pch.getNoNodes())
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE1)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E1.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i <= (size_t)n1)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE2)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E2.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*(n2-1)+1 && i <= (size_t)n1*n2)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE3)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E3.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+1 && i <= (size_t)n1*n2*(n3-1)+n1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE4)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E4.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+n1*(n2-1)+1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE5)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E5.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i <= (size_t)n1*n2 && i % n2 == 1)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE6)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E6.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i <= (size_t)n1*n2 && i % n2 == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE7)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E7.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+1 && i % n2 == 1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE8)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E8.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+1 && i % n2 == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE9)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E9.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) == 1)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE10)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E10.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) == (size_t)n1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE11)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E11.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) == (size_t)n1*(n2-1)+1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DE12)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E12.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF1)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F1.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % n1 == 1)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF2)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F2.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % n1 == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF3)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F3.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) > 0 && i % (n1*n2) <= (size_t)n1)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF4)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F4.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i % (n1*n2) >= (size_t)n1*(n2-1)+1 || i % (n1*n2) == 0)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF5)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F5.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i <= (size_t)n1*n2)
check_mpc(pch.findMPC(i, 1), n1*n2*n3);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DF6)
{
SIMNodalConstraint<SIM3D> s({2});
ASSERT_TRUE(s.read("refdata/nodal_3D_F6.xinp"));
s.preprocess();
const ASMs3D& pch = static_cast<const ASMs3D&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3);
for (size_t i=1; i <= pch.getNoNodes(); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+1)
check_mpc(pch.findMPC(i, 1), 1);
else
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs2DmxE3)
{
SIMNodalConstraint<SIM2D> s({2,2});
ASSERT_TRUE(s.read("refdata/nodal_2D_E3_mixed.xinp"));
s.preprocess();
const ASMs2Dmx& pch = static_cast<const ASMs2Dmx&>(*s.getPatch(1));
int n1, n2;
pch.getSize(n1,n2,2);
size_t ofs = pch.getNoNodes(1);
for (size_t i=1; i <= pch.getNoNodes(1); ++i) {
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
for (size_t i=1; i <= pch.getNoNodes(2); ++i) {
if (i <= (size_t)n1)
check_mpc(pch.findMPC(i+ofs, 1), ofs+n1*n2);
else
ASSERT_TRUE(pch.findMPC(i+ofs, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i+ofs, 2) == nullptr);
}
}
TEST(TestSIMNodalConstraint, ASMs3DmxE3)
{
SIMNodalConstraint<SIM3D> s({2,2});
ASSERT_TRUE(s.read("refdata/nodal_3D_E3_mixed.xinp"));
s.preprocess();
const ASMs3Dmx& pch = static_cast<const ASMs3Dmx&>(*s.getPatch(1));
int n1, n2, n3;
pch.getSize(n1,n2,n3,2);
size_t ofs = pch.getNoNodes(1);
for (size_t i=1; i <= pch.getNoNodes(1); ++i) {
ASSERT_TRUE(pch.findMPC(i, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i, 2) == nullptr);
}
for (size_t i=1; i <= pch.getNoNodes(2); ++i) {
if (i >= (size_t)n1*n2*(n3-1)+1 && i <= (size_t)n1*n2*(n3-1)+n1)
check_mpc(pch.findMPC(i+ofs, 1), 1+ofs);
else
ASSERT_TRUE(pch.findMPC(i+ofs, 1) == nullptr);
ASSERT_TRUE(pch.findMPC(i+ofs, 2) == nullptr);
}
}

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7"/>
<topologysets>
<set name="V1" type="vertex">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V1" patch="1" vertex="2" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7"/>
<topologysets>
<set name="V2" type="vertex">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="E1" type="edge">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E1" patch="1" vertex="2" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="E2" type="edge">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="E3" type="edge">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E3" patch="1" vertex="4" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="E3" type="edge">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E3" patch="1" vertex="4" comp="1" basis="2"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="E4" type="edge">
<item patch="1">4</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E4" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="V1" type="vertex">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V1" patch="1" vertex="2" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="V2" type="vertex">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="V3" type="vertex">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V3" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7"/>
<topologysets>
<set name="V4" type="vertex">
<item patch="1">4</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V4" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E1" type="edge">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E1" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E10" type="edge">
<item patch="1">10</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E10" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E11" type="edge">
<item patch="1">11</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E11" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E12" type="edge">
<item patch="1">12</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E12" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E2" type="edge">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E3" type="edge">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E3" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E3" type="edge">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E3" patch="1" vertex="1" comp="1" basis="2"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E4" type="edge">
<item patch="1">4</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E4" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E5" type="edge">
<item patch="1">5</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E5" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E6" type="edge">
<item patch="1">6</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E6" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E7" type="edge">
<item patch="1">7</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E7" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E8" type="edge">
<item patch="1">8</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E8" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="E9" type="edge">
<item patch="1">9</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="E9" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F1" type="face">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F1" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F2" type="face">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F3" type="face">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F3" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F4" type="face">
<item patch="1">4</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F4" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F5" type="face">
<item patch="1">5</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F5" patch="1" vertex="8" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="F6" type="face">
<item patch="1">6</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="F6" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V1" type="vertex">
<item patch="1">1</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V1" patch="1" vertex="2" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V2" type="vertex">
<item patch="1">2</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V2" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V3" type="vertex">
<item patch="1">3</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V3" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V4" type="vertex">
<item patch="1">4</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V4" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V5" type="vertex">
<item patch="1">5</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V5" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V6" type="vertex">
<item patch="1">6</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V6" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V7" type="vertex">
<item patch="1">7</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V7" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>

View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<simulation>
<geometry>
<refine patch="1" u="7" v="7" w="7"/>
<topologysets>
<set name="V8" type="vertex">
<item patch="1">8</item>
</set>
</topologysets>
</geometry>
<constraintovertex set="V8" patch="1" vertex="1" comp="1" basis="1"/>
</simulation>