DGtal
1.5.beta
|
Example of parallelization of an HyperRectDomain scan and ImageContainerBySTL initialization. More...
#include <numeric>
#include <iterator>
#include <chrono>
#include <string>
#include <iostream>
#include <iomanip>
#include <omp.h>
#include "DGtal/base/Common.h"
#include "DGtal/kernel/SpaceND.h"
#include "DGtal/kernel/PointVector.h"
#include "DGtal/kernel/domains/HyperRectDomain.h"
#include "DGtal/images/ImageContainerBySTLVector.h"
#include "DGtal/base/SimpleConstRange.h"
Go to the source code of this file.
Functions | |
void | tic () |
double | toc () |
template<typename TIterator > | |
SimpleConstRange< TIterator > | split_range (TIterator it_begin, TIterator it_end, std::size_t idx, std::size_t count) |
[split_range] More... | |
template<typename TIterable > | |
auto | split_range (TIterable &iterable, std::size_t idx, std::size_t count) -> decltype(split_range(iterable.begin(), iterable.end(), idx, count)) |
template<typename Image > | |
Image::Value | calc_image_checksum (Image const &image) |
[split_range] More... | |
template<typename Domain , typename Function > | |
auto | sum_fn_on_domain (Domain const &domain, Function const &fn) -> decltype(fn(domain.lowerBound())) |
template<typename Image , typename Function > | |
void | init_image_getset (Image &image, Function const &fn) |
template<typename Image , typename Function > | |
void | init_image_iter (Image &image, Function const &fn) |
int | main (int argc, char *argv[]) |
Variables | |
auto | tic_timer = std::chrono::high_resolution_clock::now() |
Example of parallelization of an HyperRectDomain scan and ImageContainerBySTL initialization.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.
This file is part of the DGtal library.
Definition in file exampleHyperRectDomainParallelScan.cpp.
Image::Value calc_image_checksum | ( | Image const & | image | ) |
[split_range]
Definition at line 93 of file exampleHyperRectDomainParallelScan.cpp.
References split_range().
Referenced by main().
void init_image_getset | ( | Image & | image, |
Function const & | fn | ||
) |
[image_init_getset]
[image_init_getset]
Definition at line 132 of file exampleHyperRectDomainParallelScan.cpp.
References image(), and split_range().
Referenced by main().
void init_image_iter | ( | Image & | image, |
Function const & | fn | ||
) |
[image_init_iter]
[image_init_iter]
Definition at line 148 of file exampleHyperRectDomainParallelScan.cpp.
References split_range().
Referenced by main().
int main | ( | int | argc, |
char * | argv[] | ||
) |
Definition at line 166 of file exampleHyperRectDomainParallelScan.cpp.
References calc_image_checksum(), domain, image(), DGtal::Trace::info(), init_image_getset(), init_image_iter(), DGtal::HyperRectDomain< TSpace >::size(), sum_fn_on_domain(), tic(), toc(), DGtal::trace, and DGtal::HyperRectDomain< TSpace >::upperBound().
auto split_range | ( | TIterable & | iterable, |
std::size_t | idx, | ||
std::size_t | count | ||
) | -> decltype(split_range(iterable.begin(), iterable.end(), idx, count)) |
Definition at line 84 of file exampleHyperRectDomainParallelScan.cpp.
References split_range().
SimpleConstRange<TIterator> split_range | ( | TIterator | it_begin, |
TIterator | it_end, | ||
std::size_t | idx, | ||
std::size_t | count | ||
) |
[split_range]
Definition at line 73 of file exampleHyperRectDomainParallelScan.cpp.
Referenced by calc_image_checksum(), init_image_getset(), init_image_iter(), split_range(), and sum_fn_on_domain().
auto sum_fn_on_domain | ( | Domain const & | domain, |
Function const & | fn | ||
) | -> decltype(fn(domain.lowerBound())) |
[domain_scan]
[domain_scan]
Definition at line 110 of file exampleHyperRectDomainParallelScan.cpp.
References domain, DGtal::HyperRectDomain< TSpace >::lowerBound(), and split_range().
Referenced by main().
void tic | ( | ) |
Definition at line 56 of file exampleHyperRectDomainParallelScan.cpp.
References tic_timer.
Referenced by main().
double toc | ( | ) |
Definition at line 62 of file exampleHyperRectDomainParallelScan.cpp.
References tic_timer.
Referenced by main().
auto tic_timer = std::chrono::high_resolution_clock::now() |
Definition at line 53 of file exampleHyperRectDomainParallelScan.cpp.