本文整理汇总了C++中Particles::N方法的典型用法代码示例。如果您正苦于以下问题:C++ Particles::N方法的具体用法?C++ Particles::N怎么用?C++ Particles::N使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Particles
的用法示例。
在下文中一共展示了Particles::N方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scalarGradient
Field TriCubicHermite::scalarGradient( const Particles& aParticles ) const
{
assert(data->nDim() == 1);
Field result("n/a","n/a", 2, aParticles.N());
if ( !allFacesReady )
{
OutputMessage statusMsg("interp coefficients not defined ", OutputMessage::errorPriority, "(Field) TriCubicHermite::scalarGradient");
log->logMessage(statusMsg);
return result;
}
for ( int i = 0; i < aParticles.N(); ++i )
{
xyzVector newGrad = scalarGradient( aParticles.physCoord(i) );
result.insertVectorToField( i, newGrad );
}
return result;
};
示例2: scalarLaplacian
Field TriCubicHermite::scalarLaplacian( const Particles& aParticles ) const
{
assert(data->nDim() == 1);
Field result("n/a","n/a", 1, aParticles.N());
if ( !allFacesReady )
{
OutputMessage statusMsg("interp coefficients not defined ", OutputMessage::errorPriority, "(Field) TriCubicHermite::scalarLaplacian");
log->logMessage(statusMsg);
return result;
}
for ( int i = 0; i < aParticles.N(); ++i )
{
double newVal = scalarLaplacian( aParticles.physCoord(i) );
result.insertScalarToField( i, newVal );
}
return result;
};
示例3: result
Field TriCubicHermite::scalarCurl2D( const Particles& aParticles ) const
{
assert(data->nDim() == 2);
Field result("n/a","n/a", 1, aParticles.N());
return result;
};
示例4: vectorDivergence
Field TriCubicHermite::vectorDivergence( const Particles& aParticles ) const
{
assert(data->nDim() == 2);
Field result("n/a","n/a", 1, aParticles.N());
return result;
};
示例5: outputForMatlab
void Field::outputForMatlab( const std::string filename, const Particles& particles ) const
{
std::ofstream file( filename.c_str() );
if ( !file )
{
OutputMessage statusMsg("cannot open file.", OutputMessage::errorPriority, "Field::outputForMatlab");
log->logMessage(statusMsg);
return;
}
file << "Field_name = '" << _name << "'; " << std::endl;
file << "units = '" << _units << "';" <<std::endl;
const int n = particles.N();
file << " x = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.x[i] << " , ";
}
file << particles.x[n-1] << " ]; " << std::endl << std::endl;
file << " y = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.y[i] << " , ";
}
file << particles.y[n-1] << " ]; " << std::endl << std::endl;
file << " x0 = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.x0[i] << " , ";
}
file << particles.x0[n-1] << " ]; " << std::endl << std::endl;
file << " y0 = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.y0[i] << " , ";
}
file << particles.y0[n-1] << " ]; " << std::endl << std::endl;
if ( particles.nDim() == 3 )
{
file << " z = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.z[i] << " , ";
}
file << particles.z[n-1] << " ]; " << std::endl << std::endl;
file << " z0 = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << particles.z0[i] << " , ";
}
file << particles.z0[n-1] << " ]; " << std::endl << std::endl;
}
if ( _nDim == 1 )
{
file << "scalarField = [ " ;
for ( int i = 0; i < n-1; ++i )
{
file << scalar[i] << " , ";
}
file << scalar[n-1] << " ]; " << std::endl;
}
else
{
if ( _nDim == 2)
{
file << "vectorField = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << xComp[i] << " , " << yComp[i] << " ; " ;
}
file << xComp[n-1] << " , " << yComp[n-1] << " ];" << std::endl;
}
else
{
file << "vectorField = [ ";
for ( int i = 0; i < n-1; ++i)
{
file << xComp[i] << " , " << yComp[i] << " , " << zComp[i] << " ; " ;
}
file << xComp[n-1] << " , " << yComp[n-1] << " , " << zComp[n-1] << " ];" << std::endl;
}
}
};