Changed: Store the rigid master points in a map with coordinates

This commit is contained in:
Knut Morten Okstad
2021-03-22 16:27:39 +01:00
parent 7c2d6c4fad
commit c6fa4730d6
7 changed files with 25 additions and 8 deletions

View File

@@ -569,7 +569,7 @@ void ASMbase::addLocal2GlobalCpl (int iSlave, int master, const Tensor& Tlg)
}
bool ASMbase::createRgdMasterNode (int& gMaster)
bool ASMbase::createRgdMasterNode (int& gMaster, const Vec3& Xpt)
{
bool newNode = gMaster == 0;
if (newNode)
@@ -582,7 +582,7 @@ bool ASMbase::createRgdMasterNode (int& gMaster)
<<" for rigid coupling in Patch "<< idx+1 << std::endl;
#endif
myMLGN.push_back(gMaster);
myRmaster.insert(myMLGN.size());
myRmaster[myMLGN.size()] = { Xpt.x, Xpt.y, Xpt.z };
return newNode;
}
@@ -630,7 +630,7 @@ bool ASMbase::addRigidCpl (int lindx, int ldim, int basis,
}
if (extraPt) // The master point is not a patch node, create an extra node
extraPt = this->createRgdMasterNode(gMaster);
extraPt = this->createRgdMasterNode(gMaster,Xmaster);
IntVec nodes;
this->getBoundaryNodes(lindx,nodes,basis,1,0,true);

View File

@@ -18,6 +18,7 @@
#include "MPCLess.h"
#include <map>
#include <set>
#include <array>
#include <string>
typedef std::vector<int> IntVec; //!< General integer vector
@@ -754,8 +755,9 @@ protected:
void addNeighbor(ASMbase* pch);
//! \brief Creates an additional master node for a rigid coupling.
//! \param gMaster Global node number of the master node
//! \param[in] Xmaster Position of the master nodal point
//! \return \e true if a new global node was added, otherwise \e false
bool createRgdMasterNode(int& gMaster);
bool createRgdMasterNode(int& gMaster, const Vec3& Xmaster);
//! \brief Adds MPC equations representing a rigid arm to a 6-DOF node
//! \param[in] gSlave Global node number of the 3-DOF slave node
//! \param[in] gMaster Global node number of the 6-DOF master node
@@ -908,7 +910,10 @@ protected:
private:
std::vector<char> myLMTypes; //!< Type of Lagrange multiplier ('L' or 'G')
std::set<size_t> myLMs; //!< Nodal indices of the Lagrange multipliers
std::set<size_t> myRmaster; //!< Nodal indices of rigid master nodes
protected:
typedef std::array<double,3> XYZ; //!< Convenience type definition
std::map<size_t,XYZ> myRmaster; //!< Rigid master nodal points
};
#endif

View File

@@ -658,6 +658,11 @@ double ASMs1D::getKnotSpan (int i) const
Vec3 ASMs1D::getCoord (size_t inod) const
{
if (inod == 0) return Vec3();
std::map<size_t,XYZ>::const_iterator it = myRmaster.find(inod);
if (it != myRmaster.end()) return Vec3(it->second.data());
int ip = (inod-1)*curv->dimension();
if (ip < 0) return Vec3();

View File

@@ -122,7 +122,7 @@ bool ASMs1DC1::addRigidCpl (int lindx, int, int,
int& gMaster, const Vec3& Xmaster, bool extraPt)
{
if (extraPt) // The master point is not a patch node, create an extra node
extraPt = this->createRgdMasterNode(gMaster);
extraPt = this->createRgdMasterNode(gMaster,Xmaster);
for (int i = 0; i < 2; i++)
{

View File

@@ -1305,6 +1305,10 @@ Vec3 ASMs2D::getCoord (size_t inod) const
std::map<size_t,size_t>::const_iterator it = xnMap.find(inod);
if (it != xnMap.end()) inod = it->second;
}
if (inod == 0) return Vec3();
std::map<size_t,XYZ>::const_iterator it = myRmaster.find(inod);
if (it != myRmaster.end()) return Vec3(it->second.data());
int ip = this->coeffInd(inod-1)*surf->dimension();
if (ip < 0) return Vec3();

View File

@@ -284,7 +284,7 @@ bool ASMs2DC1::addRigidCpl (int lindx, int ldim, int basis,
int& gMaster, const Vec3& Xmaster, bool extraPt)
{
if (extraPt) // The master point is not a patch node, create an extra node
extraPt = this->createRgdMasterNode(gMaster);
extraPt = this->createRgdMasterNode(gMaster,Xmaster);
// Get the boundary nodes, and the next layer of nodes directly connected
IntVec slaveNodes;

View File

@@ -1627,8 +1627,11 @@ Vec3 ASMs3D::getCoord (size_t inod) const
std::map<size_t,size_t>::const_iterator it = xnMap.find(inod);
if (it != xnMap.end()) inod = it->second;
}
if (inod == 0) return Vec3();
std::map<size_t,XYZ>::const_iterator it = myRmaster.find(inod);
if (it != myRmaster.end()) return Vec3(it->second.data());
int ip = this->coeffInd(inod-1)*svol->dimension();
if (ip < 0) return Vec3();