本文整理汇总了C++中cgal::Timer类的典型用法代码示例。如果您正苦于以下问题:C++ Timer类的具体用法?C++ Timer怎么用?C++ Timer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Timer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: main
int main( int argc, char **argv) {
if ( argc != 3) {
cerr << "Usage: " << argv[0] << " <infile1> <infile2>" << endl;
cerr << " Minkowsky sum of two 3d polyhedra in OFF format."
<< endl;
cerr << " Output in OFF to stdout." << endl;
exit(1);
}
Polyhedron P1;
Polyhedron P2;
read( argv[1], P1);
read( argv[2], P2);
CGAL::Timer t;
t.start();
vector<Point> points;
Add_points add;
fold( P1.vertices_begin(), P1.vertices_end(),
P2.vertices_begin(), P2.vertices_end(),
back_inserter( points),
add);
Polyhedron P3;
convex_hull_3( points.begin(), points.end(), P3);
t.stop();
std::cout << "Runtime Minkowski Sum: " << t.time() << std::endl;
// cout << P3;
return 0;
}
开发者ID:ArcEarth,项目名称:cgal,代码行数:31,代码来源:convex.cpp
示例2: bench_distance
void Scene::bench_distance(Facet_tree& tree,
const int function,
const double duration)
{
// generates 100K random point queries
srand(0);
unsigned int nb_queries = 100000;
std::vector<Point> queries;
for(unsigned int i=0;i<nb_queries;i++)
queries.push_back(random_point(tree.bbox()));
CGAL::Timer timer;
timer.start();
unsigned int nb = 0;
while(timer.time() < duration)
{
const Point& query = queries[nb%nb_queries];
switch(function)
{
case SQ_DISTANCE:
tree.squared_distance(query);
break;
case CLOSEST_POINT:
tree.closest_point(query);
break;
case CLOSEST_POINT_AND_PRIMITIVE_ID:
tree.closest_point_and_primitive(query);
}
nb++;
}
double speed = (double)nb / (double)timer.time();
std::cout << speed << " queries/s" << std::endl;
}
开发者ID:FMX,项目名称:CGAL,代码行数:35,代码来源:benchmarks.cpp
示例3: createPlane
//create a plane passing the center, with the average of some normals as normal
//the plane created is stored in m_basePlane
//用:CGAL::Plane_3<Kernel>我们这里默认了所得到的边界点是有顺序的!!!
void SgpProp::createPlane(Vertex_handle ¢er, Polyhedron* mesh)
{
std::cout << " SgpProp::createPlane() begin!" <<std::endl;
CGAL::Timer timer;
timer.start();
std::list<Vertex_handle>& main_border = mesh->main_border();
if (main_border.empty())
{
main_border = mesh->extract_longest_border();
}
std::list<Vector_3 > spokes;//a circular linked list
for (std::list<Vertex_handle>::iterator it=main_border.begin(); it!=main_border.end(); ++it)
{
Vertex_handle vh = *it;
spokes.push_back(vh->point() - center->point());
}
spokes.push_back(*(spokes.begin()) );
std::list<Vector_3 >::iterator bVector = spokes.begin();
std::list<Vector_3 >::iterator nVector = bVector;
Vector_3 sum_norm(0,0,0);
for(++nVector; nVector != spokes.end(); ++nVector,++bVector)
{
sum_norm = sum_norm + CGAL::cross_product(*bVector,*nVector);
}
m_basePlaneNormal = sum_norm/(spokes.size()+1);
std::cout << "....Time: " << timer.time() << " seconds." << std::endl<<std::endl;
}
开发者ID:aldongqing,项目名称:jjcao_code,代码行数:35,代码来源:SgpProp.cpp
示例4: tr
template < class Traits > double test_sort(unsigned int degree, unsigned int n)
{
typedef CGAL::Kinetic::Sort < Traits > Sort;
Traits tr(0, 10000);
Sort sort(tr);
CGAL::Random r;
for (unsigned int i = 0; i < n; ++i) {
std::vector < double >cf;
for (unsigned int j = 0; j < degree + 1; ++j) {
cf.push_back(r.get_double());
}
typename Traits::Kinetic_kernel::Motion_function fn(cf.begin(),
cf.end());
typename Traits::Kinetic_kernel::Point_1 pt(fn);
tr.active_points_1_table_handle()->insert(pt);
}
CGAL::Timer timer;
timer.start();
int ne = 0;
while (tr.simulator_handle()->next_event_time() !=
tr.simulator_handle()->end_time()) {
tr.simulator_handle()->set_current_event_number(tr.
simulator_handle()->
current_event_number()
+ 1);
++ne;
if (ne == 1000)
break;
}
timer.stop();
return timer.time() / static_cast < double >(ne);
}
开发者ID:Fox-Heracles,项目名称:cgal,代码行数:32,代码来源:timings.cpp
示例5: main
// just reusing the tests from the T3 package to check whether the
// periodic vertices and cells fulfill the requirements.
int main(int, char**)
{
CGAL::Timer timer;
timer.start();
_test_cls_periodic_3_tds_3(Tds());
std::cerr << timer.time() << " sec." << std::endl;
return 0;
}
开发者ID:lrineau,项目名称:cgal,代码行数:10,代码来源:test_periodic_3_triangulation_tds.cpp
示例6: main
int main (int argc, char *argv[]) {
// Cube
std::list<Plane> planes;
planes.push_back(Plane(1, 0, 0, -1));
planes.push_back(Plane(-1, 0, 0, -1));
planes.push_back(Plane(0, 1, 0, -1));
planes.push_back(Plane(0, -1, 0, -1));
planes.push_back(Plane(0, 0, 1, -1));
planes.push_back(Plane(0, 0, -1, -1));
std::vector<Point> points;
int N, steps;
// Number of points
if (argc > 1) {
N = atoi(argv[1]);
} else {
N = 50;
}
// Number of steps
if (argc > 2) {
steps = atoi(argv[2]);
} else {
steps = 10;
}
CGAL::Random_points_in_sphere_3<Point> g;
for (int i = 0; i < N; i++) {
Point p = *g++;
points.push_back(p);
}
std::ofstream bos("before_lloyd.xyz");
std::copy(points.begin(), points.end(),
std::ostream_iterator<Point>(bos, "\n"));
// Apply Lloyd algorithm: will generate points
// uniformly sampled inside a cube.
for (int i = 0; i < steps; i++) {
std::cout << "iteration " << i + 1 << std::endl;
CGAL::Timer timer;
timer.start();
lloyd_algorithm(planes.begin(),
planes.end(),
points);
timer.stop();
std::cout << "Execution time : " << timer.time() << "s\n";
}
std::ofstream aos("after_lloyd.xyz");
std::copy(points.begin(), points.end(),
std::ostream_iterator<Point>(aos, "\n"));
return 0;
}
开发者ID:freehawkzk,项目名称:cgal,代码行数:57,代码来源:lloyd_algorithm.cpp
示例7: main
int main (int argc, char *argv[])
{
// Get the name of the input file from the command line, or use the default
// fan_grids.dat file if no command-line parameters are given.
const char * filename = (argc > 1) ? argv[1] : "fan_grids.dat";
// Open the input file.
std::ifstream in_file (filename);
if (! in_file.is_open()) {
std::cerr << "Failed to open " << filename << " ..." << std::endl;
return (1);
}
// Read the segments from the file.
// The input file format should be (all coordinate values are integers):
// <n> // number of segments.
// <sx_1> <sy_1> <tx_1> <ty_1> // source and target of segment #1.
// <sx_2> <sy_2> <tx_2> <ty_2> // source and target of segment #2.
// : : : :
// <sx_n> <sy_n> <tx_n> <ty_n> // source and target of segment #n.
std::list<Segment_2> segments;
unsigned int n;
in_file >> n;
unsigned int i;
for (i = 0; i < n; ++i) {
int sx, sy, tx, ty;
in_file >> sx >> sy >> tx >> ty;
segments.push_back (Segment_2 (Point_2 (Number_type(sx), Number_type(sy)),
Point_2 (Number_type(tx), Number_type(ty))));
}
in_file.close();
// Construct the arrangement by aggregately inserting all segments.
Arrangement_2 arr;
CGAL::Timer timer;
std::cout << "Performing aggregated insertion of "
<< n << " segments." << std::endl;
timer.start();
insert (arr, segments.begin(), segments.end());
timer.stop();
// Print the arrangement dimensions.
std::cout << "V = " << arr.number_of_vertices()
<< ", E = " << arr.number_of_edges()
<< ", F = " << arr.number_of_faces() << std::endl;
std::cout << "Construction took " << timer.time()
<< " seconds." << std::endl;
return 0;
}
开发者ID:2php,项目名称:cgal,代码行数:56,代码来源:predefined_kernel.cpp
示例8: main
int main()
{
CGAL::Timer timer;
timer.start();
_test_cls_alpha_shape_3<Alpha_shape_3>();
_test_cls_alpha_shape_3_exact<EAlpha_shape_3>();
std::cerr << timer.time() << " sec." << std::endl;
return 0;
}
开发者ID:ArcEarth,项目名称:cgal,代码行数:10,代码来源:test_periodic_3_alpha_shape_3.cpp
示例9: generate_points_in
void Scene::generate_points_in(const unsigned int nb_points,
const double min,
const double max)
{
if(m_pPolyhedron == NULL)
{
std::cout << "Load polyhedron first." << std::endl;
return;
}
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
std::cout << "Construct AABB tree...";
Tree tree(faces(*m_pPolyhedron).first, faces(*m_pPolyhedron).second, *m_pPolyhedron);
std::cout << "done." << std::endl;
CGAL::Timer timer;
timer.start();
std::cout << "Generate " << nb_points << " points in interval ["
<< min << ";" << max << "]";
unsigned int nb_trials = 0;
Vector vec = random_vector();
while(m_points.size() < nb_points)
{
Point p = random_point(tree.bbox());
// measure distance
FT signed_distance = std::sqrt(tree.squared_distance(p));
// measure sign
Ray ray(p,vec);
int nb_intersections = (int)tree.number_of_intersected_primitives(ray);
if(nb_intersections % 2 != 0)
signed_distance *= -1.0;
if(signed_distance >= min &&
signed_distance <= max)
{
m_points.push_back(p);
if(m_points.size()%(nb_points/10) == 0)
std::cout << "."; // ASCII progress bar
}
nb_trials++;
}
double speed = (double)nb_trials / timer.time();
std::cout << "done (" << nb_trials << " trials, "
<< timer.time() << " s, "
<< speed << " queries/s)" << std::endl;
changed();
}
开发者ID:weaselp,项目名称:cgal,代码行数:53,代码来源:Scene.cpp
示例10: generate_edge_points
void Scene::generate_edge_points(const unsigned int nb_points)
{
if(m_pPolyhedron == NULL)
{
std::cout << "Load polyhedron first." << std::endl;
return;
}
typedef CGAL::AABB_halfedge_graph_segment_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
std::cout << "Construct AABB tree...";
Tree tree( CGAL::edges(*m_pPolyhedron).first,
CGAL::edges(*m_pPolyhedron).second,
*m_pPolyhedron);
std::cout << "done." << std::endl;
CGAL::Timer timer;
timer.start();
std::cout << "Generate edge points: ";
unsigned int nb = 0;
unsigned int nb_planes = 0;
while(nb < nb_points)
{
Plane plane = random_plane(tree.bbox());
std::list<Object_and_primitive_id> intersections;
tree.all_intersections(plane,std::back_inserter(intersections));
nb_planes++;
std::list<Object_and_primitive_id>::iterator it;
for(it = intersections.begin();
it != intersections.end();
it++)
{
Object_and_primitive_id op = *it;
CGAL::Object object = op.first;
Point point;
if(CGAL::assign(point,object))
{
m_points.push_back(point);
nb++;
}
}
}
std::cout << nb_planes << " plane queries, " << timer.time() << " s." << std::endl;
changed();
}
开发者ID:weaselp,项目名称:cgal,代码行数:51,代码来源:Scene.cpp
示例11: test_speed_for_query
void test_speed_for_query(const Tree& tree,
const Query_type query_type,
const char *query_name,
const double duration)
{
typedef typename K::Ray_3 Ray;
typedef typename K::Line_3 Line;
typedef typename K::Point_3 Point;
typedef typename K::Vector_3 Vector;
typedef typename K::Segment_3 Segment;
CGAL::Timer timer;
unsigned int nb = 0;
timer.start();
while(timer.time() < duration)
{
switch(query_type)
{
case RAY_QUERY:
{
Point source = random_point_in<K>(tree.bbox());
Vector vec = random_vector<K>();
Ray ray(source, vec);
tree.do_intersect(ray);
break;
}
case SEGMENT_QUERY:
{
Point a = random_point_in<K>(tree.bbox());
Point b = random_point_in<K>(tree.bbox());
tree.do_intersect(Segment(a,b));
break;
}
break;
case LINE_QUERY:
{
Point a = random_point_in<K>(tree.bbox());
Point b = random_point_in<K>(tree.bbox());
tree.do_intersect(Line(a,b));
break;
}
}
nb++;
}
unsigned int speed = (unsigned int)(nb / timer.time());
std::cout.precision(10);
std::cout.width(15);
std::cout << speed << " intersections/s with " << query_name << std::endl;
timer.stop();
}
开发者ID:CGAL,项目名称:cgal,代码行数:50,代码来源:aabb_intersection_triangle_test.cpp
示例12: build_skeleton
void build_skeleton(const char* fname)
{
typedef typename Kernel::Point_2 Point_2;
typedef CGAL::Polygon_2<Kernel> Polygon_2;
typedef CGAL::Straight_skeleton_builder_traits_2<Kernel> SsBuilderTraits;
typedef CGAL::Straight_skeleton_2<Kernel> Ss;
typedef CGAL::Straight_skeleton_builder_2<SsBuilderTraits,Ss> SsBuilder;
Polygon_2 pgn;
std::ifstream input(fname);
FT x,y;
while(input)
{
input >> x;
if (!input) break;
input >> y;
if (!input) break;
pgn.push_back( Point_2( typename Kernel::FT(x), typename Kernel::FT(y) ) );
}
input.close();
std::cout << "Polygon has " << pgn.size() << " points\n";
if(!pgn.is_counterclockwise_oriented()) {
std::cerr << "Polygon is not CCW Oriented" << std::endl;
}
if(!pgn.is_simple()) {
std::cerr << "Polygon is not simple" << std::endl;
}
CGAL::Timer time;
time.start();
SsBuilder ssb;
ssb.enter_contour(pgn.vertices_begin(), pgn.vertices_end());
boost::shared_ptr<Ss> straight_ske = ssb.construct_skeleton();
time.stop();
std::cout << "Time spent to build skeleton " << time.time() << "\n";
if(!straight_ske->is_valid()) {
std::cerr << "Straight skeleton is not valid" << std::endl;
}
std::cerr.precision(60);
print_straight_skeleton(*straight_ske);
}
开发者ID:Asuzer,项目名称:cgal,代码行数:49,代码来源:compare_kernels_simple_polygon_skeleton.cpp
示例13: generate_boundary_segments
void Scene::generate_boundary_segments(const unsigned int nb_slices)
{
if(m_pPolyhedron == NULL)
{
std::cout << "Load polyhedron first." << std::endl;
return;
}
typedef CGAL::AABB_face_graph_triangle_primitive<Polyhedron> Primitive;
typedef CGAL::AABB_traits<Kernel, Primitive> Traits;
typedef CGAL::AABB_tree<Traits> Tree;
typedef Tree::Object_and_primitive_id Object_and_primitive_id;
std::cout << "Construct AABB tree...";
Tree tree(faces(*m_pPolyhedron).first,faces(*m_pPolyhedron).second,*m_pPolyhedron);
std::cout << "done." << std::endl;
CGAL::Timer timer;
timer.start();
std::cout << "Generate boundary segments from " << nb_slices << " slices: ";
Vector normal((FT)0.0,(FT)0.0,(FT)1.0);
unsigned int i;
const double dz = m_bbox.zmax() - m_bbox.zmin();
for(i=0;i<nb_slices;i++)
{
FT z = m_bbox.zmin() + (FT)i / (FT)nb_slices * dz;
Point p((FT)0.0, (FT)0.0, z);
Plane plane(p,normal);
std::list<Object_and_primitive_id> intersections;
tree.all_intersections(plane,std::back_inserter(intersections));
std::list<Object_and_primitive_id>::iterator it;
for(it = intersections.begin();
it != intersections.end();
it++)
{
Object_and_primitive_id op = *it;
CGAL::Object object = op.first;
Segment segment;
if(CGAL::assign(segment,object))
m_segments.push_back(segment);
}
}
std::cout << m_segments.size() << " segments, " << timer.time() << " s." << std::endl;
changed();
}
开发者ID:weaselp,项目名称:cgal,代码行数:49,代码来源:Scene.cpp
示例14: main
int main(){
int N = 3;
CGAL::Timer cost;
std::vector<Point_d> points;
Point_d point1(1,3,5);
Point_d point2(4,8,10);
Point_d point3(2,7,9);
Point_d point(1,2,3);
points.push_back(point1);
points.push_back(point2);
points.push_back(point3);
K Kernel
D Dt(d,Kernel,Kernel);
// CGAL_assertion(Dt.empty());
// insert the points in the triangulation
cost.reset();cost.start();
std::cout << " Delaunay triangulation of "<<N<<" points in dim "<<d<< std::flush;
std::vector<Point_d>::iterator it;
for(it = points.begin(); it!= points.end(); ++it){
Dt.insert(*it);
}
std::list<Simplex_handle> NL = Dt.all_simplices(D::NEAREST);
std::cout << " done in "<<cost.time()<<" seconds." << std::endl;
CGAL_assertion(Dt.is_valid() );
CGAL_assertion(!Dt.empty());
Vertex_handle v = Dt.nearest_neighbor(point);
Simplex_handle s = Dt.simplex(v);
std::vector<Point_d> Simplex_vertices;
for(int j=0; j<=d; ++j){
Vertex_handle vertex = Dt.vertex_of_simplex(s,j);
Simplex_vertices.push_back(Dt.associated_point(vertex));
}
std::vector<K::FT> coords;
K::Barycentric_coordinates_d BaryCoords;
BaryCoords(Simplex_vertices.begin(), Simplex_vertices.end(),point,std::inserter(coords, coords.begin()));
std::cout << coords[0] << std::endl;
return 0;
}
开发者ID:anjishnu1991,项目名称:interpolation,代码行数:49,代码来源:delaunay_test.cpp
示例15: while
bool
load_cin_file(std::istream& ifs, SDG& sdg) {
std::cerr << "Loading file... ";
CGAL::Timer timer;
timer.start();
bool not_first = false;
if(!ifs.good())
return false;
Point_2 p, q, qold;
int point_counter = 0;
SDGLinf::Site_2 site;
while (ifs >> site) {
//std::cout << site << std::endl;
if (site.is_point()) {
//std::cout << "site is point" << std::endl;
q = site.point();
points.push_back(q);
++point_counter;
} else if (site.is_segment()) {
//std::cout << "site is seg" << std::endl;
p = site.source();
q = site.target();
if(not_first and (p == qold)) {
points.push_back(q);
//std::cout << "push pq old" << std::endl;
constraints.push_back(std::make_pair(point_counter-1, point_counter));
++point_counter;
}
else {
points.push_back(p);
points.push_back(q);
//std::cout << "push pq new" << std::endl;
constraints.push_back(std::make_pair(point_counter, point_counter+1));
point_counter += 2;
}
} else {
if (not_first) {
return false;
} else {
continue;
}
}
qold = q;
not_first = true;
}
std::cerr << "done (" << timer.time() << "s)" << std::endl;
insert_constraints_using_spatial_sort(sdg);
return true;
}
开发者ID:Asuzer,项目名称:cgal,代码行数:49,代码来源:benchmark-gen.cpp
示例16: Meshing_thread
Meshing_thread* cgal_code_mesh_3(const Polyhedron* pMesh,
const Polylines_container& polylines,
QString filename,
const double facet_angle,
const double facet_sizing,
const double facet_approx,
const double tet_sizing,
const double tet_shape,
bool protect_features,
CGAL::Three::Scene_interface* scene)
{
if(!pMesh) return 0;
std::cerr << "Meshing file \"" << qPrintable(filename) << "\"\n";
std::cerr << " angle: " << facet_angle << std::endl
<< " facets size bound: " << facet_sizing << std::endl
<< " approximation bound: " << facet_approx << std::endl
<< " tetrahedra size bound: " << tet_sizing << std::endl;
std::cerr << "Build AABB tree...";
CGAL::Timer timer;
timer.start();
// Create domain
Polyhedral_mesh_domain* p_domain = new Polyhedral_mesh_domain(*pMesh);
if(polylines.empty() && protect_features) {
p_domain->detect_features();
}
if(! polylines.empty()){
p_domain->add_features(polylines.begin(), polylines.end());
protect_features = true; // so that it will be passed in make_mesh_3
}
std::cerr << "done (" << timer.time() << " ms)" << std::endl;
Scene_c3t3_item* p_new_item = new Scene_c3t3_item;
p_new_item->set_scene(scene);
Mesh_parameters param;
param.facet_angle = facet_angle;
param.facet_sizing = facet_sizing;
param.facet_approx = facet_approx;
param.tet_sizing = tet_sizing;
param.tet_shape = tet_shape;
param.protect_features = protect_features;
typedef ::Mesh_function<Polyhedral_mesh_domain> Mesh_function;
Mesh_function* p_mesh_function = new Mesh_function(p_new_item->c3t3(),
p_domain, param);
return new Meshing_thread(p_mesh_function, p_new_item);
}
开发者ID:virtualworldDady,项目名称:cgal,代码行数:49,代码来源:Mesh_3_plugin_cgal_code.cpp
示例17:
void
run_benchmark(SDG& sdg)
{
load_cin_file(std::cin, sdg);
CGAL::Timer timer;
timer.start();
if(! sdg.is_valid(true, 1) ){
std::cerr << "invalid data structure" << std::endl;
} else {
std::cerr << "valid data structure" << std::endl;
}
timer.stop();
std::cerr << "Data structure checking time = " << timer.time() << "s\n";
}
开发者ID:Asuzer,项目名称:cgal,代码行数:15,代码来源:benchmark-gen.cpp
示例18: meshRemoveIntersectedTriangles
TrianglesList meshRemoveIntersectedTriangles(TrianglesList &triangles)
{
CGAL::Timer timer;
timer.start();
TrianglesList result;
//Collision boxes
std::vector<BoxInt> boxes;
std::list<Triangle>::iterator triangleIter;
for(triangleIter = triangles.begin(); triangleIter != triangles.end(); ++triangleIter)
{
//Triangle t = *triangleIter;
TriangleVisitedInfoMC *tvi = new TriangleVisitedInfoMC;
tvi->triangle = &(*triangleIter); //Use the pointer, it should not change into the container, since there aren't new added elements
tvi->intersected = false;
boxes.push_back( BoxInt( (*triangleIter).bbox(), tvi ));
}
//Do intersection
CGAL::box_self_intersection_d( boxes.begin(), boxes.end(), reportSelfIntersectionCallback);
//cycle on boxes and build result and delete tvi
std::vector<BoxInt>::iterator vectorBoxesIter;
for(vectorBoxesIter = boxes.begin(); vectorBoxesIter != boxes.end(); ++vectorBoxesIter)
{
BoxInt boxInt = *vectorBoxesIter;
TriangleVisitedInfoMC *tviHandled = boxInt.handle();
if ((!(tviHandled->intersected)) && (!(tviHandled->triangle->is_degenerate())))
{
Triangle t = *(tviHandled->triangle);
result.push_back(t);
}
delete tviHandled;
}
timer.stop();
std::cout << "Total meshRemoveIntersectedTriangles time: " << timer.time() << std::endl;
return result;
}
开发者ID:Sunwinds,项目名称:larmor-physx,代码行数:48,代码来源:MeshCheck.cpp
示例19: main
int main(int argc, const char *argv[])
{
CavConfig cfg;
const char *run_control_file = "cavity_volumes_fin.inp";
if (argc > 1)
run_control_file = argv[1];
if (!cfg.init(run_control_file)) {
std::cerr << "Error while initializing from run control file : " << run_control_file << std::endl;
return 2;
}
cfg.out_inf << "Run control file : " << run_control_file << std::endl;
CGAL::Timer t;
int processed_cnt = 0;
cfg.out_inf << std::endl;
t.start();
while (cfg.next_timestep()) {
const Array_double_3 &a = cfg.atoms.back();
cfg.out_inf << "Number of input atoms : " << cfg.atoms.size() << std::endl;
cfg.out_inf << "MD info : " << cfg.ts_info << std::endl;
cfg.out_inf << "Box : [ " << cfg.box[0] << ", " << cfg.box[1] << ", " << cfg.box[2] << " ]" << std::endl;
cfg.out_inf << "Last atom : " << a[0] << " " << a[1] << " " << a[2] << std::endl;
if (!process_conf(cfg)) {
cfg.out_inf << "process_conf() error. Exiting..." << std::endl;
return 1;
}
processed_cnt++;
}
t.stop();
// save accumulated per-atom surfaces
if (cfg.out_asf.is_open()) {
long double total_surf = std::accumulate(cfg.atom_confs_surf.begin(), cfg.atom_confs_surf.end(), 0.0L);
cfg.out_asf << total_surf << std::endl; // first line is total exposed surface of all atoms in all confs
cfg.out_asf << cfg.atom_confs_surf.size() << std::endl; // second line is the number of atoms
for (size_t i = 0; i < cfg.atom_confs_surf.size(); i++)
cfg.out_asf << cfg.atom_confs_surf[i] << std::endl;
}
cfg.out_inf << "Processed " << processed_cnt << " (of " << cfg.traj_ts_cnt() << ") configurations." << std::endl;
cfg.out_inf << "Time: " << t.time() << " sec." << std::endl;
return 0;
}
开发者ID:a-anik,项目名称:cavity-volumes-pbc,代码行数:48,代码来源:cavity_volumes_fin.cpp
示例20: main
int main()
{
CGAL::Timer timer;
timer.start();
typedef CGAL::Periodic_3_Delaunay_triangulation_3< PTT1 > P3T3_1;
_test_cls_periodic_3_delaunay_3( P3T3_1() );
typedef CGAL::Periodic_3_Delaunay_triangulation_3< PTT2 > P3T3_2;
_test_cls_periodic_3_delaunay_3( P3T3_2() );
// typedef CGAL::Periodic_3_Delaunay_triangulation_3< PTT3 > P3T3_3;
// this takes too much time for the test suite.
//_test_cls_periodic_3_delaunay_3( P3T3_3(), true );
std::cerr << timer.time() << " sec." << std::endl;
return 0;
}
开发者ID:ArcEarth,项目名称:cgal,代码行数:17,代码来源:test_periodic_3_delaunay_3.cpp
注:本文中的cgal::Timer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论