Changed: The SIMgeneric::evalPoint method can optionally return

global node number as opposed to local patch-wise numbers, and
use SIMbase::getPatch in the SIMoutput::preprocessResPtGroup method.
This commit is contained in:
Knut Morten Okstad 2017-04-23 01:33:32 +02:00
parent 891798e639
commit 762e35c5a4
3 changed files with 11 additions and 10 deletions

View File

@ -56,11 +56,12 @@ Vector SIMgeneric::getSolution (const Vector& psol, const double* par,
int SIMgeneric::evalPoint (const double* xi, Vec3& X, double* param,
int patch) const
int patch, bool global) const
{
ASMbase* pch = this->getPatch(patch,true);
if (!pch) return -1;
double dummy[3];
return pch->evalPoint(xi, param ? param : dummy, X);
int inod = pch->evalPoint(xi, param ? param : dummy, X);
return inod > 0 && global ? pch->getNodeID(inod) : inod;
}

View File

@ -51,9 +51,9 @@ public:
//! \param[out] X The Cartesian coordinates of the point
//! \param[out] param The parameters of the point in the knot-span domain
//! \param[in] patch 1-based patch index containing the evaluation point
//! \return Local node number within the patch that matches the point
int evalPoint(const double* xi, Vec3& X,
double* param = nullptr, int patch = 1) const;
//! \return Patch-local or global node number of node that matches the point
int evalPoint(const double* xi, Vec3& X, double* param = nullptr,
int patch = 1, bool global = false) const;
};
#endif

View File

@ -207,14 +207,14 @@ void SIMoutput::preprocessResPtGroup (std::string& ptFile, ResPointVec& points)
{
for (ResPointVec::iterator p = points.begin(); p != points.end();)
{
int pid = this->getLocalPatchIndex(p->patch);
if (pid < 1 || myModel[pid-1]->empty())
ASMbase* pch = this->getPatch(p->patch,true);
if (!pch || pch->empty())
p = points.erase(p);
else if ((p->inod = myModel[pid-1]->evalPoint(p->u,p->u,p->X)) < 0)
else if ((p->inod = pch->evalPoint(p->u,p->u,p->X)) < 0)
p = points.erase(p);
else
{
p->npar = myModel[pid-1]->getNoParamDim();
p->npar = pch->getNoParamDim();
int ipt = 1 + (int)(p-points.begin());
if (ipt == 1) IFEM::cout <<'\n';
IFEM::cout <<"Result point #"<< ipt <<": patch #"<< p->patch;
@ -229,7 +229,7 @@ void SIMoutput::preprocessResPtGroup (std::string& ptFile, ResPointVec& points)
if (p->npar > 1) IFEM::cout <<')';
if (p->inod > 0) IFEM::cout <<", node #"<< p->inod;
if (p->inod > 0 && myModel.size() > 1)
IFEM::cout <<", global #"<< myModel[pid-1]->getNodeID(p->inod);
IFEM::cout <<", global #"<< pch->getNodeID(p->inod);
IFEM::cout <<", X = "<< p->X << std::endl;
p++;
}