110 likes | 125 Views
Dataflow Datatypes. Dataflow Datatypes Revisited. Matrix. Field. ColorMap. Geometry. Matrices: Class Hierarchy. Matrix -- base class
E N D
Dataflow Datatypes Revisited Matrix Field ColorMap Geometry
Matrices: Class Hierarchy • Matrix -- base class • get, put, [ ], nrows, ncols, get_row, get_col, get_val, zero, mult, mult_transpose, print, {is_,as_,}{sparse,dense,column}, cg_solve, bicg_solve, scalar_multiply • SparseRowMatrix • int *rows, int *cols, double *a, int nnz; • ColumnMatrix • double *data; • DenseMatrix • double **data;
Matrices: External Libraries • PETSc • Preconditioners: jacobi, bijacobi, sor, eisenstat, icc, ilu, asm, sles, lu, mg, spai, milu, nn, cholesky, ramg • Solvers: KSRICHARDSON, PSPCHEBYCHEV, KSPGG, KSPGMRES, KSPTCQMR, KSPBCGS, KSPBGS, KSPTFQMR, KSPCR, KSPLSQR, KSPBICG, KSPPREONLY • BLAS and Atlas • Faster linear-algebra via loop unrolling
Dataflow Datatypes Revisited Matrix Field ColorMap Geometry
Fields: Mesh + Data Geometry Regular Irregular PointCloudField Data int, float, double, … Vector, Tensor, … ScanlineField CurveField QuadSurfField TriSurfField ImageField Data_at (center) Properties TetVolField LatVolField HexVolField
Meshes • Mesh -- base class • get_bounding_box, transform, synchronize, dimensionality • PointCloudMesh • Iterators, get_{node,edge,face,cell}, locate, get_weights, add_node • HexVolMesh • Iterators, get_{node,edge,face,cell}, locate, get_weights, add_node, add_elem • ImageMesh • Same, plus new Index type
Fields • Field::GenericField -- base class • GenericField<MeshType, DataType>, data_at • Holds Handle to Mesh • Owns Data -- resize_fdata() [new DataType for FData{2,3}d] • Freeze/Thaw (data) • value(), set_value(), fdata() • mesh(), mesh_detach() • All fields derive from GenericField • PointCloudMesh -> PointCloudField • ImageMesh -> ImageField • Persistent::Datatype::PropertyManager::Field::GenericField • io(), PerTypeIDlock/genmap of attrib/valuesdata_at, interfaces • Mesh::PropertyManager
Persistent • Serialize data for disk I/O • Eventually for distributed data marshalling • Architecture independent • Build atop XDR • Slow for big data • Optional circumvention for DenseMatrix • Data files are (somewhat) human readable, but should ~not~ be generated / edited by anything other than SCIRun • Use “convert” programs
Persistent • void • Matrix::io(Piostream& stream) • { • /* int version = */ stream.begin_class("Matrix", MATRIX_VERSION); • PropertyManager::io(stream); • stream.end_class(); • } • void ColumnMatrix::io(Piostream& stream) • { • /* int version = */stream.begin_class("ColumnMatrix", COLUMNMATRIX_VERSION); • Matrix::io(stream); • stream.io(rows); • if(stream.reading()) { • data=scinew double[rows]; • } • int i; • for(i=0;i<rows;i++) • stream.io(data[i]); • stream.end_class(); • }
Converter: CurveFieldToText • MeshHandle mH = handle->mesh(); • CurveMesh *cm = dynamic_cast<CurveMesh *>(mH.get_rep()); • CurveMesh::Node::iterator niter; • CurveMesh::Node::iterator niter_end; • CurveMesh::Node::size_type nsize; • cm->begin(niter); cm->end(niter_end); cm->size(nsize); • cerr << "Number of points = "<< nsize <<"\n"; • while(niter != niter_end) { • Point p; • cm->get_center(p, *niter); • fprintf(fPts, "%lf %lf %lf\n", p.x(), p.y(), p.z()); • ++niter; • } • CurveMesh::Edge::size_type esize; • CurveMesh::Edge::iterator eiter; • CurveMesh::Edge::iterator eiter_end; • CurveMesh::Node::array_type edge_nodes(2); • cm->size(esize); • cm->begin(eiter); • cm->end(eiter_end); • FILE *fEdges = fopen(edgesName, "wt"); • cerr << "Number of edges = "<< esize <<"\n"; • while(eiter != eiter_end) { • cm->get_nodes(edge_nodes, *eiter); • fprintf(fEdges, "%d %d\n", (int)edge_nodes[0]+baseIndex, (int)edge_nodes[1]+baseIndex); • ++eiter; • }