当前位置: 首页>>代码示例>>C++>>正文


C++ Particles::N方法代码示例

本文整理汇总了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;
};
开发者ID:pbosler,项目名称:lpmCxx,代码行数:18,代码来源:TriCubicHermite.cpp

示例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;
};
开发者ID:pbosler,项目名称:lpmCxx,代码行数:18,代码来源:TriCubicHermite.cpp

示例3: result

Field TriCubicHermite::scalarCurl2D( const Particles& aParticles ) const
{
	assert(data->nDim() == 2);
	Field result("n/a","n/a", 1, aParticles.N());
	return result;
};
开发者ID:pbosler,项目名称:lpmCxx,代码行数:6,代码来源:TriCubicHermite.cpp

示例4: vectorDivergence

Field TriCubicHermite::vectorDivergence( const Particles& aParticles ) const
{
	assert(data->nDim() == 2);
	Field result("n/a","n/a", 1, aParticles.N());
	return result;
};
开发者ID:pbosler,项目名称:lpmCxx,代码行数:6,代码来源:TriCubicHermite.cpp

示例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;
		}
	}
};
开发者ID:pbosler,项目名称:lpmCxx,代码行数:91,代码来源:Field.cpp


注:本文中的Particles::N方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。