本文整理汇总了C++中SolutionPtr::solutionValues方法的典型用法代码示例。如果您正苦于以下问题:C++ SolutionPtr::solutionValues方法的具体用法?C++ SolutionPtr::solutionValues怎么用?C++ SolutionPtr::solutionValues使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SolutionPtr
的用法示例。
在下文中一共展示了SolutionPtr::solutionValues方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: writePatchValues
void writePatchValues(double xMin, double xMax, double yMin, double yMax,
SolutionPtr solution, VarPtr u1, string filename,
int numPoints=100)
{
FieldContainer<double> points = pointGrid(xMin,xMax,yMin,yMax,numPoints);
FieldContainer<double> values(numPoints*numPoints);
solution->solutionValues(values, u1->ID(), points);
ofstream fout(filename.c_str());
fout << setprecision(15);
fout << "X = zeros(" << numPoints << ",1);\n";
// fout << "Y = zeros(numPoints);\n";
fout << "U = zeros(" << numPoints << "," << numPoints << ");\n";
for (int i=0; i<numPoints; i++)
{
fout << "X(" << i+1 << ")=" << points(i,0) << ";\n";
}
for (int i=0; i<numPoints; i++)
{
fout << "Y(" << i+1 << ")=" << points(i,1) << ";\n";
}
for (int i=0; i<numPoints; i++)
{
for (int j=0; j<numPoints; j++)
{
int pointIndex = i*numPoints + j;
fout << "U("<<i+1<<","<<j+1<<")=" << values(pointIndex) << ";" << endl;
}
}
fout.close();
}
示例2: solutionData
FieldContainer<double> solutionData(FieldContainer<double> &points, SolutionPtr solution, VarPtr u1) {
int numPoints = points.dimension(0);
FieldContainer<double> values(numPoints);
solution->solutionValues(values, u1->ID(), points);
FieldContainer<double> xyzData(numPoints, 3);
for (int ptIndex=0; ptIndex<numPoints; ptIndex++) {
xyzData(ptIndex,0) = points(ptIndex,0);
xyzData(ptIndex,1) = points(ptIndex,1);
xyzData(ptIndex,2) = values(ptIndex);
}
return xyzData;
}