本文整理汇总了C++中NODE::Getname方法的典型用法代码示例。如果您正苦于以下问题:C++ NODE::Getname方法的具体用法?C++ NODE::Getname怎么用?C++ NODE::Getname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NODE
的用法示例。
在下文中一共展示了NODE::Getname方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Factor
//.........这里部分代码省略.........
//# ifdef _MPI_DBG
// REPORT::rpt.Output( " (PRECO_ILUT::Factor) starting with 2.4\n" );
//# endif
if( project->subdom.npr > 1 )
{
SUBDOM* subdom = &project->subdom;
INFACE* inface = subdom->inface;
int df = eqs->dfcn;
for( int s=0; s<subdom->npr; s++ )
{
int np = inface[s].np; // number of interface nodes
if( np > 0 && s > subdom->pid ) // downstream interface nodes
{
for( int n=0; n<np; n++ )
{
NODE* ndr = inface[s].node[n];
if( !isFS(ndr->flag, NODE::kDry) ) // nothing to send if the node is dry...
{
SUB* subr = ndr->sub;
while( subr )
{
if( subr->no == s ) break;
subr = subr->next;
}
if( !subr->dry ) // ...or if the node is dry in
{ // any adjacent subdomain
for( int e=0; e<df; e++ )
{
int req = eqs->GetEqno( ndr, e );
if( req >= 0 )
{
int cnt = 0;
for( int c=0; c<width[req]; c++ )
{
int ceq = index[req][c];
NODE* ndc = eqs->eqnoNode[ceq];
int eid = eqs->eqid[ceq];
// is ndc a point on interface "s"?
SUB* subc = ndc->sub;
while( subc )
{
if( subc->no == s ) break;
subc = subc->next;
}
if( subc )
{
inface[s].sia1[cnt] = eid;
inface[s].sia2[cnt] = ndc->Getname();
inface[s].send[cnt] = ILU[req][c];
cnt++;
}
}
MPI_Send( &cnt, 1, MPI_INT, s, 1, MPI_COMM_WORLD );
if( cnt )
{
MPI_Send( inface[s].sia1, cnt, MPI_CHAR, s, 2, MPI_COMM_WORLD );
MPI_Send( inface[s].sia2, cnt, MPI_INT, s, 3, MPI_COMM_WORLD );
MPI_Send( inface[s].send, cnt, MPI_DOUBLE, s, 4, MPI_COMM_WORLD );
}
}
}
}
}
}
}
}
}
# endif
////////////////////////////////////////////////////////////////////////////////////////
# ifdef kDebug
{
char filename[80];
if( project->subdom.npr == 1 )
sprintf( filename, "ilu_2.4.dbg" );
else
sprintf( filename, "ilu_2.4_%02d.dbg", project->subdom.pid+1 );
eqs->ExportEQS( filename, crsi, project );
}
# endif
//# ifdef _MPI_DBG
// REPORT::rpt.Output( " (PRECO_ILUT::Factor) ILU factorization finished\n" );
//# endif
}
示例2: DoDryRewet
//.........这里部分代码省略.........
nd->z = nd->zor;
}
if( dryRew->method == 2 )
{
region->DryRewet( dryRew->dryLimit, dryRew->rewetLimit, dryRew->countDown, &del, &wel );
}
else if( dryRew->method == 3 )
{
region->RewetDry( dryRew->dryLimit, dryRew->rewetLimit, dryRew->countDown, &del, &wel );
}
////////////////////////////////////////////////////////////////////////////////////////////
MPI_Comm_Dry( project, false );
wetted = project->subdom.Mpi_sum( wetted );
sprintf( text, "\n (MODEL::DoDryRewet) %d interface nodes have got wet\n", wetted );
REPORT::rpt.Output( text, 3 );
}
}
////////////////////////////////////////////////////////////////////////////////////////////////
// reset interface flags: kInface, kInface_DN and kInface_UP; this is
// necessary for the correct ordering of equations in EQS::ResetEqOrder()
project->subdom.SetInface( region );
# endif // #ifdef _MPI_
////////////////////////////////////////////////////////////////////////////////////////////////
// determine 1D boundary elements and ----------------------------------------------------------
// set up slip velocity boundary conditions
Initialize();
SetNormal();
SetRotation();
region->SetSlipFlow();
REPORT::rpt.PrintTime( 3 );
// ================================================================================================
# ifdef kDebug_1
for( int n=0; n<region->Getnp(); n++ )
{
NODE* ndbg = region->Getnode(n);
switch( ndbg->Getname() )
{
case 3654:
REPORT::rpt.Message( "\n" );
REPORT::rpt.Message( "### NODE %6d: inface = %d\n", ndbg->Getname(), ndbg->flag&NODE::kInface );
REPORT::rpt.Message( "### : inface_dn = %d\n", ndbg->flag&NODE::kInface_DN );
REPORT::rpt.Message( "### : inface_up = %d\n", ndbg->flag&NODE::kInface_UP );
REPORT::rpt.Message( "\n" );
REPORT::rpt.Message( "### : dry = %d\n", ndbg->flag&NODE::kDry );
REPORT::rpt.Message( "### : marsh = %d\n", ndbg->flag&NODE::kMarsh );
REPORT::rpt.Message( "### : H = %f\n", ndbg->v.S - ndbg->zor );
REPORT::rpt.Message( "\n" );
REPORT::rpt.Message( "### : bound = %d\n", ndbg->flag&NODE::kBound );
REPORT::rpt.Message( "### : inflow = %d\n", ndbg->flag&NODE::kInlet );
REPORT::rpt.Message( "### : outflow = %d\n", ndbg->flag&NODE::kOutlet );
REPORT::rpt.Message( "### : rotat = %d\n", ndbg->flag&NODE::kRotat );
REPORT::rpt.Message( "### : noMoment = %d\n", ndbg->flag&NODE::kNoMoment );
REPORT::rpt.Message( "\n" );
REPORT::rpt.Message( "### : countDown = %d\n", ndbg->countDown );
{
SUB* sub = ndbg->sub;
while( sub )
{
REPORT::rpt.Message( "### SUBDOM %4d: dry = %d\n", sub->no+1, sub->dry );
sub = sub->next;
}
}
break;
}
}
# endif
// ================================================================================================
}
else
{
// set up structure for connection of nodes to elements ----------------------------------------
// dry elements are not taken into consideration
region->Connection( ELEM::kDry );
}
if( dried ) *dried = del;
if( wetted ) *wetted = wel;
region->firstDryRew = false;
}
示例3: Solve
//.........这里部分代码省略.........
# endif
MPI_Send( &cnt, 1, MPI_INT, s, 1, MPI_COMM_WORLD );
if( cnt ) MPI_Send( inface[s].send, cnt, MPI_DOUBLE, s, 2, MPI_COMM_WORLD );
}
}
}
# endif
////////////////////////////////////////////////////////////////////////////////////////
# ifdef kDebug
{
FILE* dbg;
char filename[80];
MODEL* model = project->M2D;
GRID* region = model->region;
if( project->subdom.npr == 1 )
sprintf( filename, "forwX.dbg" );
else
sprintf( filename, "forwX_%02d.dbg", project->subdom.pid );
dbg = fopen( filename, "w" );
fprintf( dbg, "%d\n", region->Getnp() );
for( int n=0; n<region->Getnp(); n++ )
{
NODE* nd = region->Getnode( n );
for( int e=0; e<eqs->dfcn; e++ )
{
int eqno = eqs->GetEqno( nd, e );
fprintf( dbg, "%5d %1d ", nd->Getname(), e );
if( eqno >= 0 )
fprintf( dbg, "%14.6le\n", X[eqno] );
else
fprintf( dbg, "%14.6le\n", 0.0 );
}
}
fclose( dbg );
}
# endif
# ifdef _MPI_DBG
REPORT::rpt.Output( " (PRECO_ILUT::Solve) forward solve finished\n" );
# endif
////////////////////////////////////////////////////////////////////////////////////////
// 2. solve for X with upper part of matrix ILU (backward substitution)
//
// 2.1 MPI communication:
// receive from subdomains with larger pid (2 <- 3)
// s > pid ==> downstream interface nodes
# ifdef _MPI_DBG
REPORT::rpt.Output( " (PRECO_ILUT::Solve) starting with 2.1\n" );
# endif
# ifdef _MPI_
if( project->subdom.npr > 1 )
{
SUBDOM* subdom = &project->subdom;
INFACE* inface = subdom->inface;
示例4: AssembleEqs_im
//.........这里部分代码省略.........
{
int rind = dfcn*nnd + j;
int row = eqs->GetEqno( el, j );
if( row >= 0 )
{
REALPR* APtr = m_A[row];
double* estifmPtr = estifm[rind];
vector[row] += force[rind];
for( int k=0; k<nnd; k++ ) // loop on nodes
{
for( int l=0; l<dfcn; l++ ) // loop on node-equations
{
int cind = k + l*nnd;
int col = eqs->GetEqno( el->nd[k], l );
if( col >= 0 )
{
for( int m=0; m<m_width[row]; m++ )
{
if( col == m_index[row][m] )
{
APtr[m] += (REALPR) estifmPtr[cind];
break;
}
}
}
}
}
for( int l=0; l<dfel; l++ ) // loop on element-equations
{
int cind = dfcn*nnd + l;
int col = eqs->GetEqno( el, l );
if( col >= 0 )
{
for( int m=0; m<m_width[row]; m++ )
{
if( col == m_index[row][m] )
{
APtr[m] += (REALPR) estifmPtr[cind];
break;
}
}
}
}
}
}
}
REPORT::rpt.Message( 3, "\n\n%-25s%s\n\n%15s %1s %8s %14s %14s\n\n",
" (CRSMAT::Assemble...)", "Newton-Raphson-residuum / force vector ...",
" ", " ", " node", " average", " maximum" );
for( int e=0; e<dfcn; e++ )
{
int no = 0;
double ave = 0.0;
double max = 0.0;
for( int n=0; n<model->np; n++ )
{
NODE* nd = model->node[n];
int eqno = eqs->GetEqno( nd, e );
if( eqno >= 0 )
{
double vec = vector[eqno];
ave += vec;
if( fabs(vec) > fabs(max) )
{
max = vec;
no = nd->Getname();
}
}
}
int tot = neq;
//////////////////////////////////////////////////////////////////////////////////////
# ifdef _MPI_
max = project->subdom.Mpi_max( max );
tot = project->subdom.Mpi_sum( eqs->neq_up );
ave = project->subdom.Mpi_sum( ave );
# endif
//////////////////////////////////////////////////////////////////////////////////////
if( tot ) ave /= tot;
REPORT::rpt.Message( 3, " %15s %1d %8d %14.5le %14.5le\n", " ", e+1, no, ave, max );
}
REPORT::rpt.Message( 3, "\n" );
}
示例5: MPI_Comm_Dry
//.........这里部分代码省略.........
for( int n=0; n<npinf; n++ )
{
NODE* nd = inface[s].node[n];
SUB* sub = nd->sub;
while( sub )
{
if( sub->no == s )
{
if( !sub->dry )
{
nd->v.U += inface[s].recv[3*n];
nd->v.V += inface[s].recv[3*n+1];
nd->v.S += inface[s].recv[3*n+2];
cnt[nd->Getno()]++;
}
}
sub = sub->next;
}
}
}
}
for( int n=0; n<rgnp; n++ )
{
if( cnt[n] > 1 )
{
NODE* nd = region->Getnode(n);
nd->v.U /= cnt[n];
nd->v.V /= cnt[n];
nd->v.S /= cnt[n];
}
}
MEMORY::memo.Detach( cnt );
}
# ifdef kDebug_2
{
char text[200];
sprintf( text, "### DEBUGGING: List of dry interface nodes...\n\n" );
REPORT::rpt.Output( text, 1 );
for( int s=0; s<subdom->npr; s++ )
{
int np = inface[s].np;
if( np > 0 )
{
sprintf( text, "interface to domain %d\n", s+1 );
REPORT::rpt.Output( text, 1 );
for( int n=0; n<np; n++ )
{
NODE* nd = inface[s].node[n];
SUB* sub = nd->sub;
while( sub )
{
if( sub->no == s )
{
if( sub->dry )
{
if( isFS(nd->flag, NODE::kDry) )
{
sprintf( text, "dry interface node %5d: dry\n", nd->Getname() );
REPORT::rpt.Output( text, 1 );
}
else
{
sprintf( text, "wet interface node %5d: dry\n", nd->Getname() );
REPORT::rpt.Output( text, 1 );
}
}
else
{
if( isFS(nd->flag, NODE::kDry) )
{
sprintf( text, "dry interface node %5d: wet\n", nd->Getname() );
REPORT::rpt.Output( text, 1 );
}
else
{
sprintf( text, "wet interface node %5d: wet\n", nd->Getname() );
REPORT::rpt.Output( text, 1 );
}
}
}
sub = sub->next;
}
}
}
}
}
# endif // #ifdef kDebug_2
# endif // #ifdef _MPI_
}
示例6: ReportDry
void GRID::ReportDry( PROJECT* project,
double dryLimit,
int countDown )
{
int dryNodes = false;
// check for dry nodes -------------------------------------------------------------------
for( int n=0; n<Getnp(); n++ )
{
NODE* nd = Getnode(n);
nd->countDown = 0;
CF( nd->flag, NODE::kDry );
if( (nd->v.S - nd->z) < dryLimit )
{
SF( nd->flag, NODE::kDry );
dryNodes = true;
}
}
// report all dry nodes ------------------------------------------------------------------
if( dryNodes )
{
REPORT::rpt.Output( "\n\n----------------------------------------", 5 );
REPORT::rpt.Output( "------------------------------\n", 5 );
REPORT::rpt.Output( "\n ... the following nodes are dry\n", 5 );
int jdry = 0;
for( int n=0; n<Getnp(); n++ )
{
NODE* nd = Getnode(n);
if( isFS(nd->flag, NODE::kDry) )
{
char text[20];
sprintf( text, " %5d", nd->Getname() );
REPORT::rpt.Output( text, 5 );
jdry++;
if( !( jdry % 10) ) REPORT::rpt.Output( "\n", 5 );
}
}
if( jdry % 10 ) REPORT::rpt.Output( "\n", 5 );
// loop on all elements ----------------------------------------------------------------
for( int e=0; e<Getne(); e++ )
{
ELEM* el = Getelem(e);
CF( el->flag, ELEM::kDry );
int nnd = el->Getnnd();
for( int i=0; i<nnd; i++ )
{
if( isFS(el->nd[i]->flag, NODE::kDry) )
{
SF( el->flag, ELEM::kDry );
break;
}
}
}
for( int n=0; n<Getnp(); n++ )
{
NODE* nd = Getnode(n);
SF( nd->flag, NODE::kDry );
}
// loop on all elements: all nodes at wet elements are wet -----------------------------
for( int e=0; e<Getne(); e++ )
{
ELEM* el = Getelem(e);
if( !isFS(el->flag, ELEM::kDry) )
{
int nnd = el->Getnnd();
for( int i=0; i<nnd; i++ ) CF( el->nd[i]->flag, NODE::kDry );
}
}
int idry = 0;
//.........这里部分代码省略.........
示例7: Dry
int GRID::Dry( double dryLimit,
int countDown )
{
// initialization: mark all dry nodes and elements -------------------------------------
for( int n=0; n<Getnp(); n++ )
{
NODE* nd = Getnode(n);
if( isFS(nd->flag, NODE::kDry) ) nd->mark = true;
else nd->mark = false;
SF( nd->flag, NODE::kDry );
}
for( int e=0; e<Getne(); e++ )
{
ELEM* el = Getelem(e);
if ( isFS(el->flag, ELEM::kDry) ) el->mark = true;
else el->mark = false;
CF( el->flag, ELEM::kDry );
}
// loop on all elements ----------------------------------------------------------------
for( int e=0; e<Getne(); e++ )
{
ELEM* el = Getelem(e);
int ncn = el->Getncn();
for( int i=0; i<ncn; i++ )
{
// set element dry, if flow depth is less than dry limit ---------------------------
// or the node was already dry
double H = el->nd[i]->v.S - el->nd[i]->z;
if( H < dryLimit || el->nd[i]->mark )
{
SF( el->flag, ELEM::kDry );
}
}
}
// loop on all elements: all nodes at wet elements are wet -----------------------------
for( int e=0; e<Getne(); e++ )
{
ELEM* el = Getelem(e);
if( !isFS(el->flag, ELEM::kDry) )
{
int nnd = el->Getnnd();
for( int i=0; i<nnd; i++ ) CF( el->nd[i]->flag, NODE::kDry );
}
}
// report all nodes that have got newly dry --------------------------------------------
REPORT::rpt.Output( "\n (dry) the following nodes have got dry\n", 5 );
int jdry = 0;
for( int n=0; n<Getnp(); n++ )
{
NODE* nd = Getnode(n);
if( isFS(nd->flag, NODE::kDry) )
{
nd->v.U = 0.0;
nd->v.V = 0.0;
nd->v.S = nd->z;
nd->v.K = 0.0;
nd->v.D = 0.0;
nd->v.dUdt = 0.0;
nd->v.dVdt = 0.0;
nd->v.dSdt = 0.0;
if( !nd->mark )
{
nd->countDown = countDown;
char text[20];
sprintf( text, " %5d", nd->Getname() );
REPORT::rpt.Output( text, 2 );
jdry++;
if( !( jdry % 10) ) REPORT::rpt.Output( "\n", 5 );
}
//.........这里部分代码省略.........
示例8: Rewet
//.........这里部分代码省略.........
CF( nd->flag, NODE::kDry );
// look for boundary conditions ------------------------------------------------
BCON *bc = &nd->bc;
// ... outflow boundary or fixed flow depth h --------------------------------
if( isFS(bc->kind, BCON::kOutlet) || isFS(bc->kind, BCON::kSetS) )
{
nd->v.S = bc->val->S;
}
// ... inflow boundary or fixed velocities U,V -------------------------------
if( isFS(bc->kind, BCON::kInlet) )
{
nd->v.U = bc->val->U * bc->niox / (nd->v.S - nd->z);
nd->v.V = bc->val->U * bc->nioy / (nd->v.S - nd->z);
}
else if( !isFS(bc->kind, BCON::kAutoSlip) )
{
if ( isFS(bc->kind, BCON::kFixU) ) nd->v.U = bc->val->U;
if ( isFS(bc->kind, BCON::kFixV) ) nd->v.V = bc->val->V;
}
# ifdef kDebug
sprintf( text,
" %5d (UVhKDvt): %9.2le %9.2le %9.2le %9.2le %9.2le %9.2le\n",
nd->Getname(),
nd->v.U,
nd->v.V,
nd->v.S - nd->z,
nd->v.K,
nd->v.D,
nd->vt );
REPORT::rpt.Output( text, 5 );
# else
sprintf( text, " %5d", nd->Getname() );
REPORT::rpt.Output( text, 5 );
l++;
if( !( l % 10) ) REPORT::rpt.Output( "\n", 5 );
# endif
m++;
}
else
{
nd->v.U = 0.0;
nd->v.V = 0.0;
nd->v.K = 0.0;
nd->v.D = 0.0;
nd->v.S = nd->z;
}
}
nd->mark = false;
}
示例9: Update
void EQS::Update( MODEL* model,
SUBDOM* subdom,
double* X,
int ind,
int varInd,
double* maxAbs,
double* maxPer,
double* avAbs,
double* avPer,
int* noAbs,
int* noPer )
{
*maxAbs = 0.0;
*maxPer = 0.0;
*avAbs = 0.0;
*avPer = 0.0;
*noAbs = -1;
*noPer = -1;
int countAbs = 0;
int countPer = 0;
for( int n=0; n<model->np; n++ )
{
NODE* nd = model->node[n];
int eqno = GetEqno( nd, ind );
if( eqno >= 0 )
{
double chAbs = fabs( X[eqno] );
// absolute changes, maximum and on average
*avAbs += chAbs;
countAbs++;
if( chAbs > *maxAbs )
{
*maxAbs = chAbs;
*noAbs = nd->Getname();
}
// percentage changes, maximum and on average
double H = nd->v.S - nd->z;
double val = 0.0;
switch( varInd )
{
case kVarU: val = nd->v.U; break;
case kVarV: val = nd->v.V; break;
case kVarH:
case kVarS: val = H; break;
case kVarK: val = nd->v.K; break;
case kVarD: val = nd->v.D; break;
case kVarC: val = nd->v.C; break;
case kVarQb: val = nd->v.Qb; break;
case kVarDz: val = nd->dz; break;
case kVarUH: val = H * nd->v.U; break;
case kVarVH: val = H * nd->v.V; break;
}
if( fabs(val) > 1.0e-9 )
{
double chPer = chAbs / fabs(val);
*avPer += fabs(chPer);
countPer++;
if( fabs(chPer) > fabs(*maxPer) )
{
*maxPer = chPer;
*noPer = nd->Getname();
}
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
# ifdef _MPI_
int mpi_noAbs;
int mpi_noPer;
double mpi_maxAbs;
double mpi_maxPer;
if( subdom->pid == 0 )
{
MPI_Status status;
for( int s=1; s<subdom->npr; s++ )
{
MPI_Recv( &mpi_noAbs, 1, MPI_INT, s, 1, MPI_COMM_WORLD, &status );
MPI_Recv( &mpi_maxAbs, 1, MPI_DOUBLE, s, 2, MPI_COMM_WORLD, &status );
//.........这里部分代码省略.........
示例10: Boundary
//.........这里部分代码省略.........
for( int re=0; re<region->Getne(); re++ )
{
ELEM* el = region->Getelem(re);
if( isFS(el->flag, ELEM::kDry) ) continue;
int ncn = el->Getncn();
int nnd = el->Getnnd();
for( int i=ncn; i<nnd; i++ )
{
// check, if el->nd[i] is a midside boundary node ----------------------------------
if( isFS(el->nd[i]->flag, NODE::kBound) )
{
ELEM* bd = bound->Getelem(be);
boundList[el->nd[i]->Getno()] = bd;
int left = i - ncn;
int rght = (left + 1) % ncn;
bd->nd[0] = el->nd[left]; // corner nodes
bd->nd[1] = el->nd[rght];
bd->nd[2] = el->nd[i]; // midside node
SF( bd->nd[0]->flag, NODE::kBound );
SF( bd->nd[1]->flag, NODE::kBound );
// set shape specifications ------------------------------------------------------
bd->Setshape( kLine );
bd->Setname( el->Getname() );
SF( bd->flag, ELEM::kBound );
bd->type = el->type;
bd->areaFact = 1.0;
be++;
}
}
}
////////////////////////////////////////////////////////////////////////////////////////
// communicate boundary nodes
//# ifdef _MPI_DBG
// REPORT::rpt.Output( " (MODEL::Boundary) communication of boundary nodes", 1 );
//# endif
# ifdef _MPI_
if( subdom->npr > 1 )
{
INFACE* inface = subdom->inface;
// loop on all interfaces: exchange bound flag ---------------------------------------
for( int s=0; s<subdom->npr; s++ )
{
MPI_Status status;
int npinf = inface[s].np;
if( npinf > 0 )