本文整理汇总了C++中FILE::SetPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ FILE::SetPoints方法的具体用法?C++ FILE::SetPoints怎么用?C++ FILE::SetPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FILE
的用法示例。
在下文中一共展示了FILE::SetPoints方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doOutput
void
VTKXMLExportModule :: doOutput(TimeStep *tStep)
{
if ( !testTimeStepOutput(tStep) ) {
return;
}
#ifdef __VTK_MODULE
vtkSmartPointer<vtkUnstructuredGrid> stream = vtkSmartPointer<vtkUnstructuredGrid>::New();
vtkSmartPointer<vtkPoints> nodes = vtkSmartPointer<vtkPoints>::New();
vtkSmartPointer<vtkIdList> elemNodeArray = vtkSmartPointer<vtkIdList>::New();
#else
FILE *stream = this->giveOutputStream(tStep);
struct tm *current;
time_t now;
time(&now);
current = localtime(&now);
fprintf(stream, "<!-- TimeStep %e Computed %d-%02d-%02d at %02d:%02d:%02d -->\n", tStep->giveIntrinsicTime(), current->tm_year+1900, current->tm_mon+1, current->tm_mday, current->tm_hour, current->tm_min, current->tm_sec);
fprintf(stream, "<VTKFile type=\"UnstructuredGrid\" version=\"0.1\" byte_order=\"LittleEndian\">\n");
fprintf(stream, "<UnstructuredGrid>\n");
#endif
Domain *d = emodel->giveDomain(1);
Element *elem;
FloatArray *coords;
int nelem = d->giveNumberOfElements();
this->giveSmoother(); // make sure smoother is created
// output nodes Region By Region
int nregions = this->smoother->giveNumberOfVirtualRegions();
int regionDofMans, totalcells;
IntArray mapG2L, mapL2G;
/* loop over regions */
for ( int ireg = 1; ireg <= nregions; ireg++ ) {
if ( ( ireg > 0 ) && ( this->regionsToSkip.contains(ireg) ) ) {
continue;
}
// assemble local->global and global->local region map
// and get number of single cells to process
// the composite cells exported individually
this->initRegionNodeNumbering(mapG2L, mapL2G, regionDofMans, totalcells, d, ireg);
/* start default piece containing all single cell elements
* the elements with composite geometry are assumed to be exported in individual pieces
* after the default one
*/
#ifndef __PARALLEL_MODE
if ( regionDofMans && totalcells ) {
#else
if ( 1 ) {
#endif
#ifdef __VTK_MODULE
for ( int inode = 1; inode <= regionDofMans; inode++ ) {
coords = d->giveNode(mapL2G.at(inode))->giveCoordinates();
int dims = coords->giveSize();
nodes->InsertNextPoint(coords->at(1), dims >= 2 ? coords->at(2) : 0.0, dims >= 3 ? coords->at(3) : 0.0);
}
stream->SetPoints(nodes);
#else
fprintf(stream, "<Piece NumberOfPoints=\"%d\" NumberOfCells=\"%d\">\n", regionDofMans, totalcells);
// export nodes in region as vtk vertices
fprintf(stream, "<Points>\n <DataArray type=\"Float64\" NumberOfComponents=\"3\" format=\"ascii\"> ");
for ( int inode = 1; inode <= regionDofMans; inode++ ) {
coords = d->giveNode( mapL2G.at(inode) )->giveCoordinates();
for ( int i = 1; i <= coords->giveSize(); i++ ) {
fprintf( stream, "%e ", coords->at(i) );
}
for ( int i = coords->giveSize() + 1; i <= 3; i++ ) {
fprintf(stream, "%e ", 0.0);
}
}
fprintf(stream, "</DataArray>\n</Points>\n");
#endif
// output all cells of the piece
int nelemNodes;
IntArray cellNodes;
#ifdef __VTK_MODULE
stream->Allocate(nelem);
#else
fprintf(stream, "<Cells>\n");
// output the connectivity data
fprintf(stream, " <DataArray type=\"Int32\" Name=\"connectivity\" format=\"ascii\"> ");
#endif
for ( int ielem = 1; ielem <= nelem; ielem++ ) {
elem = d->giveElement(ielem);
if ( ( ireg > 0 ) && ( this->smoother->giveElementVirtualRegionNumber(ielem) != ireg ) ) {
continue;
}
if ( this->isElementComposite(elem) ) {
continue; // composite cells exported individually
}
//.........这里部分代码省略.........