]> https://gitweb.dealii.org/ - dealii.git/log
dealii.git
7 years agoShorten matrix-free multigrid tests 4432/head
Martin Kronbichler [Sun, 28 May 2017 21:13:20 +0000 (23:13 +0200)]
Shorten matrix-free multigrid tests

7 years agoMerge pull request #4430 from davydden/pum_test
Martin Kronbichler [Sun, 28 May 2017 20:23:28 +0000 (22:23 +0200)]
Merge pull request #4430 from davydden/pum_test

make fe_enriched_step-36 do less refinements and thereby faster

7 years agomake fe_enriched_step-36 do less refinements and thereby faster 4430/head
Denis Davydov [Sun, 28 May 2017 20:10:57 +0000 (22:10 +0200)]
make fe_enriched_step-36 do less refinements and thereby faster

7 years agoMerge pull request #4429 from drwells/fix-task_09
Matthias Maier [Sun, 28 May 2017 19:23:36 +0000 (14:23 -0500)]
Merge pull request #4429 from drwells/fix-task_09

Fix tests/base/task_09.cc.

7 years agoFix tests/base/task_09.cc. 4429/head
David Wells [Sun, 28 May 2017 17:35:17 +0000 (13:35 -0400)]
Fix tests/base/task_09.cc.

The current implementation of the Task class will call join() on the created
thread in its destructor. Hence, the tasks in the loop run in sequence instead
of in parallel since they immediately go out of scope after each loop iteration,
which is not the point of the test.

7 years agoMerge pull request #4424 from tamiko/fix_tag_feature
David Wells [Sun, 28 May 2017 16:22:37 +0000 (12:22 -0400)]
Merge pull request #4424 from tamiko/fix_tag_feature

CMake: Bugfix: run get_latest_tag only if git is recent enough

7 years agoMerge pull request #4423 from drwells/remove-petsc-vector-references
Daniel Arndt [Sun, 28 May 2017 15:28:19 +0000 (17:28 +0200)]
Merge pull request #4423 from drwells/remove-petsc-vector-references

Remove remaining references to PETScWrappers::Vector.

7 years agoCMake: Bugfix: run get_latest_tag only if git is recent enough 4424/head
Matthias Maier [Sun, 28 May 2017 05:52:36 +0000 (00:52 -0500)]
CMake: Bugfix: run get_latest_tag only if git is recent enough

Fixes #4420

7 years agoRemove remaining references to PETScWrappers::Vector. 4423/head
David Wells [Sun, 28 May 2017 01:57:32 +0000 (21:57 -0400)]
Remove remaining references to PETScWrappers::Vector.

7 years agoMerge pull request #4369 from class4kayaker/timer_data
David Wells [Sat, 27 May 2017 14:37:01 +0000 (10:37 -0400)]
Merge pull request #4369 from class4kayaker/timer_data

Add function to access timer data from within program

7 years agoAdd function to access timer data from within program 4369/head
Jonathan Robey [Wed, 10 May 2017 23:25:28 +0000 (16:25 -0700)]
Add function to access timer data from within program

7 years agoMerge pull request #4413 from bangerth/use-MPI_Abort
David Wells [Fri, 26 May 2017 20:28:44 +0000 (16:28 -0400)]
Merge pull request #4413 from bangerth/use-MPI_Abort

Use MPI_Abort instead of std::abort.

7 years agoMerge pull request #4418 from bangerth/address-coverity-2
Bruno Turcksin [Fri, 26 May 2017 18:00:48 +0000 (14:00 -0400)]
Merge pull request #4418 from bangerth/address-coverity-2

Check that a stream is good while we read.

7 years agoMerge pull request #4417 from bangerth/address-coverity
Bruno Turcksin [Fri, 26 May 2017 17:43:47 +0000 (13:43 -0400)]
Merge pull request #4417 from bangerth/address-coverity

Better document why we take a large argument by value.

7 years agoCheck that a stream is good while we read. 4418/head
Wolfgang Bangerth [Fri, 26 May 2017 16:03:29 +0000 (10:03 -0600)]
Check that a stream is good while we read.

This addresses another (correct) Coverity warning.

7 years agoBetter document why we take a large argument by value. 4417/head
Wolfgang Bangerth [Fri, 26 May 2017 15:37:58 +0000 (09:37 -0600)]
Better document why we take a large argument by value.

This addresses an issue found by Coverity. We copy the argument intentionally.

7 years agoMerge pull request #4416 from SoilRos/master
Daniel Arndt [Fri, 26 May 2017 09:41:54 +0000 (11:41 +0200)]
Merge pull request #4416 from SoilRos/master

fixed direct reference of _feature to petsc in CHECK_MPI_INTERFACE

7 years agoMerge pull request #4407 from davydden/cmake_tag
Denis Davydov [Fri, 26 May 2017 03:30:59 +0000 (05:30 +0200)]
Merge pull request #4407 from davydden/cmake_tag

cmake: query for latest tag

7 years agofixed direct reference of _feature to petsc in CHECK_MPI_INTERFACE 4416/head
Santiago Ospina [Thu, 25 May 2017 21:24:25 +0000 (23:24 +0200)]
fixed direct reference of _feature to petsc in CHECK_MPI_INTERFACE

7 years agoinstall git scripts and use get_latest_tag.sh to get Git tag 4407/head
Denis Davydov [Wed, 24 May 2017 05:47:17 +0000 (07:47 +0200)]
install git scripts and use get_latest_tag.sh to get Git tag

7 years agoMerge pull request #4414 from davydden/mf_base_constraints
Martin Kronbichler [Wed, 24 May 2017 16:25:12 +0000 (18:25 +0200)]
Merge pull request #4414 from davydden/mf_base_constraints

factor out pre- and post-processing of dst/src inside MatrixFreeOpera…

7 years agoadd auxiliary git bash scripts
Matthias Maier [Wed, 24 May 2017 05:34:41 +0000 (07:34 +0200)]
add auxiliary git bash scripts

7 years agoMerge pull request #4412 from bangerth/avoid-warning
David Wells [Wed, 24 May 2017 03:59:04 +0000 (21:59 -0600)]
Merge pull request #4412 from bangerth/avoid-warning

Avoid warnings about unused variables.

7 years agoMerge pull request #4410 from drwells/add-update-ghosts-tests
David Wells [Wed, 24 May 2017 03:57:50 +0000 (21:57 -0600)]
Merge pull request #4410 from drwells/add-update-ghosts-tests

Add tests for update_ghost_values.

7 years agoUse MPI_Abort instead of std::abort. 4413/head
Wolfgang Bangerth [Tue, 23 May 2017 21:35:49 +0000 (15:35 -0600)]
Use MPI_Abort instead of std::abort.

7 years agoAvoid warnings about unused variables. 4412/head
Wolfgang Bangerth [Tue, 23 May 2017 21:33:42 +0000 (15:33 -0600)]
Avoid warnings about unused variables.

7 years agoAdd tests for update_ghost_values. 4410/head
David Wells [Mon, 22 May 2017 19:19:55 +0000 (15:19 -0400)]
Add tests for update_ghost_values.

These functions need to exist (for PETSc and Trilinos vectors and block
vectors) but should not do anything.

7 years agofactor out pre- and post-processing of dst/src inside MatrixFreeOperators::Base:... 4414/head
Denis Davydov [Tue, 23 May 2017 15:15:52 +0000 (17:15 +0200)]
factor out pre- and post-processing of dst/src inside MatrixFreeOperators::Base::mult_add() into two functions

7 years agoMerge pull request #4409 from drwells/remove-read-input-docs
Bruno Turcksin [Tue, 23 May 2017 15:14:13 +0000 (11:14 -0400)]
Merge pull request #4409 from drwells/remove-read-input-docs

Remove references to the old read_input function.

7 years agoRemove references to the old read_input function. 4409/head
David Wells [Mon, 22 May 2017 18:47:08 +0000 (14:47 -0400)]
Remove references to the old read_input function.

7 years agoadd DEAL_II_GIT_TAG to deal.IIConfig.cmake
Denis Davydov [Mon, 22 May 2017 15:22:16 +0000 (17:22 +0200)]
add DEAL_II_GIT_TAG to deal.IIConfig.cmake

7 years agoadd an optional argument to DEAL_II_QUERY_GIT_INFORMATION macro
Denis Davydov [Mon, 22 May 2017 10:14:36 +0000 (12:14 +0200)]
add an optional argument to DEAL_II_QUERY_GIT_INFORMATION macro

7 years agoMerge pull request #4403 from luca-heltai/regularize-mesh
Luca Heltai [Mon, 22 May 2017 10:08:17 +0000 (12:08 +0200)]
Merge pull request #4403 from luca-heltai/regularize-mesh

Regularize corner cells.

7 years agoImplemented regularize corner cells 4403/head
Luca Heltai [Thu, 18 May 2017 13:38:27 +0000 (15:38 +0200)]
Implemented regularize corner cells

7 years agocmake: query for latest tag
Denis Davydov [Mon, 22 May 2017 09:54:24 +0000 (11:54 +0200)]
cmake: query for latest tag

7 years agoMerge pull request #4406 from drwells/add-update-ghost-values-stubs
Martin Kronbichler [Mon, 22 May 2017 05:37:36 +0000 (07:37 +0200)]
Merge pull request #4406 from drwells/add-update-ghost-values-stubs

Implement update_ghost_values stubs.

7 years agoImplement update_ghost_values stubs. 4406/head
David Wells [Sun, 21 May 2017 21:28:11 +0000 (17:28 -0400)]
Implement update_ghost_values stubs.

7 years agoMerge pull request #4405 from Rombur/cuda_setup_tests
Denis Davydov [Fri, 19 May 2017 15:36:10 +0000 (17:36 +0200)]
Merge pull request #4405 from Rombur/cuda_setup_tests

Guard FIND_PACKAGE(CUDA) with DEAL_II_WITH_CUDA.

7 years agoMerge pull request #4401 from davydden/solvercontrol
Timo Heister [Fri, 19 May 2017 14:28:54 +0000 (10:28 -0400)]
Merge pull request #4401 from davydden/solvercontrol

add ConsecutiveControl

7 years agoGuard FIND_PACKAGE(CUDA) with DEAL_II_WITH_CUDA. 4405/head
Bruno Turcksin [Fri, 19 May 2017 12:50:03 +0000 (08:50 -0400)]
Guard FIND_PACKAGE(CUDA) with DEAL_II_WITH_CUDA.

7 years agoMerge pull request #4402 from Rombur/cuda_tests
Denis Davydov [Thu, 18 May 2017 06:19:18 +0000 (08:19 +0200)]
Merge pull request #4402 from Rombur/cuda_tests

Check for cuda only if configured with cuda support.

7 years agoadd ConsecutiveControl 4401/head
Denis Davydov [Wed, 17 May 2017 14:25:01 +0000 (16:25 +0200)]
add ConsecutiveControl

7 years agoCheck for cuda only if configured with cuda support. 4402/head
Bruno Turcksin [Wed, 17 May 2017 20:31:39 +0000 (16:31 -0400)]
Check for cuda only if configured with cuda support.

7 years agoMerge pull request #4398 from davydden/remove_wrong_todo
David Wells [Tue, 16 May 2017 15:04:15 +0000 (11:04 -0400)]
Merge pull request #4398 from davydden/remove_wrong_todo

remove wrong TODO in template-arguments.in

7 years agoREAL_SERIAL_VECTORS and SERIAL_VECTORS are not the same. 4398/head
Denis Davydov [Tue, 16 May 2017 09:41:05 +0000 (11:41 +0200)]
REAL_SERIAL_VECTORS and SERIAL_VECTORS are not the same.

The former contains only real-valued vectors, i.e.
DEAL_II_EXPAND_PETSC_MPI_VECTOR_REAL will be empty if
PETSc is build with complex linear algebra.

7 years agoMerge pull request #4394 from drwells/fix-rebase-print
Denis Davydov [Tue, 16 May 2017 12:43:43 +0000 (14:43 +0200)]
Merge pull request #4394 from drwells/fix-rebase-print

Fix the output of the deprecation script.

7 years agoFix the output of the deprecation script. 4394/head
David Wells [Sun, 14 May 2017 16:55:46 +0000 (12:55 -0400)]
Fix the output of the deprecation script.

Some tags (e.g., 'rebase_here') may not be version numbers so we should not drop
the first letter.

7 years agoMerge pull request #4293 from Rombur/matrixfree_gpu
Martin Kronbichler [Tue, 16 May 2017 05:49:27 +0000 (07:49 +0200)]
Merge pull request #4293 from Rombur/matrixfree_gpu

Matrix-free gpu

7 years agoAdd changelog entry. 4293/head
Bruno Turcksin [Sun, 14 May 2017 03:05:21 +0000 (23:05 -0400)]
Add changelog entry.

7 years agoAdd test for CUDA support of matrix-free.
Bruno Turcksin [Sun, 14 May 2017 03:05:05 +0000 (23:05 -0400)]
Add test for CUDA support of matrix-free.

7 years agoAdd CUDA support of matrix-free.
Bruno Turcksin [Sun, 14 May 2017 03:04:03 +0000 (23:04 -0400)]
Add CUDA support of matrix-free.

7 years agoRename cuda_vector tests.
Bruno Turcksin [Sun, 14 May 2017 03:02:39 +0000 (23:02 -0400)]
Rename cuda_vector tests.

7 years agoAugment documentation of CUDA atomic.
Bruno Turcksin [Sun, 14 May 2017 03:01:25 +0000 (23:01 -0400)]
Augment documentation of CUDA atomic.

7 years agoAdd CUDA support for tensor.
Bruno Turcksin [Sun, 14 May 2017 03:00:33 +0000 (23:00 -0400)]
Add CUDA support for tensor.

7 years agoMerge pull request #4397 from masterleinad/fix_pgi
Daniel Arndt [Mon, 15 May 2017 15:02:05 +0000 (17:02 +0200)]
Merge pull request #4397 from masterleinad/fix_pgi

Fixes for compiling with PGI

7 years agoFixes for compiling with PGI 4397/head
Daniel Arndt [Mon, 15 May 2017 13:43:10 +0000 (15:43 +0200)]
Fixes for compiling with PGI

7 years agoMerge pull request #4395 from masterleinad/remove_reorder_cuthill_mckee
Daniel Arndt [Mon, 15 May 2017 09:01:13 +0000 (11:01 +0200)]
Merge pull request #4395 from masterleinad/remove_reorder_cuthill_mckee

Remove deprecated SparsityTools::reorder_Cuthill_McKee

7 years agoMerge pull request #4396 from masterleinad/remove_unused_helper
Denis Davydov [Mon, 15 May 2017 04:20:30 +0000 (06:20 +0200)]
Merge pull request #4396 from masterleinad/remove_unused_helper

Remove unused helper function

7 years agoRemove unused helper function 4396/head
Daniel Arndt [Sun, 14 May 2017 22:56:41 +0000 (00:56 +0200)]
Remove unused helper function

7 years agoRemove deprecated SparsityTools::reorder_Cuthill_McKee 4395/head
Daniel Arndt [Sun, 14 May 2017 23:07:26 +0000 (01:07 +0200)]
Remove deprecated SparsityTools::reorder_Cuthill_McKee

7 years agoMerge pull request #4391 from masterleinad/remove_ez_rows_columns
David Wells [Sun, 14 May 2017 16:58:42 +0000 (12:58 -0400)]
Merge pull request #4391 from masterleinad/remove_ez_rows_columns

Remove deprecated BlockSparseMatrixEZ<Number>::n_rows/n_cols

7 years agoMerge pull request #4390 from masterleinad/fix_chunk_sparsity_pattern_12
Daniel Arndt [Sun, 14 May 2017 15:53:39 +0000 (17:53 +0200)]
Merge pull request #4390 from masterleinad/fix_chunk_sparsity_pattern_12

Fix chunk_sparsity_pattern_12

7 years agoRemove deprecated BlockSparseMatrixEZ<Number>::n_rows/n_cols 4391/head
Daniel Arndt [Sun, 14 May 2017 13:30:12 +0000 (15:30 +0200)]
Remove deprecated BlockSparseMatrixEZ<Number>::n_rows/n_cols

7 years agoFix chunk_sparsity_pattern_12 4390/head
Daniel Arndt [Sun, 14 May 2017 13:24:37 +0000 (15:24 +0200)]
Fix chunk_sparsity_pattern_12

7 years agoMerge pull request #4389 from masterleinad/remove_system_j_s_m
Denis Davydov [Sun, 14 May 2017 10:49:04 +0000 (12:49 +0200)]
Merge pull request #4389 from masterleinad/remove_system_j_s_m

Remove Utilities::System::job_supports_mpi()

7 years agoRemove Utilities::System::job_supports_mpi() 4389/head
Daniel Arndt [Sun, 14 May 2017 09:22:47 +0000 (11:22 +0200)]
Remove Utilities::System::job_supports_mpi()

7 years agoMerge pull request #4388 from bangerth/avoid-warning-2
Daniel Arndt [Sun, 14 May 2017 08:44:57 +0000 (10:44 +0200)]
Merge pull request #4388 from bangerth/avoid-warning-2

Avoid a warning about an unused constructor argument.

7 years agoModify CMake for CUDA matrix-free.
Bruno Turcksin [Sun, 14 May 2017 02:58:30 +0000 (22:58 -0400)]
Modify CMake for CUDA matrix-free.

7 years agoAvoid a warning about an unused constructor argument. 4388/head
Wolfgang Bangerth [Sun, 14 May 2017 02:38:05 +0000 (20:38 -0600)]
Avoid a warning about an unused constructor argument.

Annoyingly, my compiler warns about =default constructors whenever we name constructor
arguments. It says they are unused -- which is patently wrong: the argument is used
just fine, we just never explicitly reference the *name* of the argument. Either way,
work around this.

7 years agoMerge pull request #4387 from drwells/add-missing-indexset-instantiations
David Wells [Sun, 14 May 2017 01:50:19 +0000 (21:50 -0400)]
Merge pull request #4387 from drwells/add-missing-indexset-instantiations

Add missing FEValues IndexSet instantiations.

7 years agoAdd missing FEValues IndexSet instantiations. 4387/head
David Wells [Sun, 14 May 2017 00:23:20 +0000 (20:23 -0400)]
Add missing FEValues IndexSet instantiations.

7 years agoMerge pull request #4386 from masterleinad/fix_point_constructor
David Wells [Sat, 13 May 2017 23:04:05 +0000 (19:04 -0400)]
Merge pull request #4386 from masterleinad/fix_point_constructor

Add user-defined constructor for Point<dim> back in

7 years agoMerge pull request #4385 from drwells/fix-clang-compilation
Daniel Arndt [Sat, 13 May 2017 22:08:06 +0000 (00:08 +0200)]
Merge pull request #4385 from drwells/fix-clang-compilation

Fix clang compilation

7 years agoAdd user-defined constructor for Point<dim> back in 4386/head
Daniel Arndt [Sat, 13 May 2017 21:55:28 +0000 (23:55 +0200)]
Add user-defined constructor for Point<dim> back in

7 years agoRemove an unused private variable. 4385/head
David Wells [Sat, 13 May 2017 21:24:48 +0000 (17:24 -0400)]
Remove an unused private variable.

7 years agoUse a Tensor for a direction vector.
David Wells [Sat, 13 May 2017 21:23:02 +0000 (17:23 -0400)]
Use a Tensor for a direction vector.

The old version works since Point<3> inherits from Tensor<1, 3> and this is only
implemented for the spacedim == 3 case.

7 years agoMerge pull request #4381 from masterleinad/use_valid_arguments
Wolfgang Bangerth [Sat, 13 May 2017 19:51:00 +0000 (13:51 -0600)]
Merge pull request #4381 from masterleinad/use_valid_arguments

Use valid arguments in ChunkSparsityPattern constructor

7 years agoMerge pull request #4375 from masterleinad/use_override_consistently
Daniel Arndt [Sat, 13 May 2017 19:16:16 +0000 (21:16 +0200)]
Merge pull request #4375 from masterleinad/use_override_consistently

Use override consistently

7 years agoUse valid arguments in ChunkSparsityPattern constructor 4381/head
Daniel Arndt [Sat, 13 May 2017 16:08:17 +0000 (18:08 +0200)]
Use valid arguments in ChunkSparsityPattern constructor

7 years agoMerge pull request #4379 from davydden/change_assert
Denis Davydov [Fri, 12 May 2017 14:59:44 +0000 (16:59 +0200)]
Merge pull request #4379 from davydden/change_assert

change assert in p::d::Tria::load()

7 years agoUse override consistently 4375/head
Daniel Arndt [Fri, 12 May 2017 13:50:04 +0000 (15:50 +0200)]
Use override consistently

7 years agoMerge pull request #4377 from drwells/default-constructor
Denis Davydov [Fri, 12 May 2017 13:35:46 +0000 (15:35 +0200)]
Merge pull request #4377 from drwells/default-constructor

Use '= default' for some constructors.

7 years agochange assert in p::d::Tria::load() 4379/head
Denis Davydov [Fri, 12 May 2017 13:09:34 +0000 (15:09 +0200)]
change assert in p::d::Tria::load()

7 years agoMerge pull request #4367 from drwells/add-oned-manifold
Wolfgang Bangerth [Fri, 12 May 2017 12:35:36 +0000 (06:35 -0600)]
Merge pull request #4367 from drwells/add-oned-manifold

Add get_manifold() to 1D vertex iterators.

7 years agoMerge pull request #4374 from davydden/mf_gmg_tests_fix
Martin Kronbichler [Fri, 12 May 2017 09:58:18 +0000 (11:58 +0200)]
Merge pull request #4374 from davydden/mf_gmg_tests_fix

MF GMG tests (fix one and add another failing)

7 years agoadd another MF GMG test which was failing prior to cb5c93d 4374/head
Denis Davydov [Fri, 12 May 2017 09:34:58 +0000 (11:34 +0200)]
add another MF GMG test which was failing prior to cb5c93d

7 years agoenable threads in MF GMG test, add additional output
Denis Davydov [Fri, 12 May 2017 09:33:49 +0000 (11:33 +0200)]
enable threads in MF GMG test, add additional output

7 years agoMerge pull request #4376 from kronbichler/fix_matrix_free_with_threads
Denis Davydov [Fri, 12 May 2017 09:31:38 +0000 (11:31 +0200)]
Merge pull request #4376 from kronbichler/fix_matrix_free_with_threads

Fix bug in matrix free thread graph creation.

7 years agoUse '= default' for some constructors. 4377/head
David Wells [Fri, 12 May 2017 00:16:44 +0000 (20:16 -0400)]
Use '= default' for some constructors.

7 years agoAdd get_manifold() to 1D vertex iterators. 4367/head
David Wells [Wed, 10 May 2017 17:14:44 +0000 (13:14 -0400)]
Add get_manifold() to 1D vertex iterators.

7 years agoMerge pull request #4371 from davydden/trial_load_assert
Bruno Turcksin [Thu, 11 May 2017 19:52:29 +0000 (15:52 -0400)]
Merge pull request #4371 from davydden/trial_load_assert

add an assert in p::d::Tria::load() that the file exists

7 years agoFix bug in matrix free thread graph creation. 4376/head
Martin Kronbichler [Thu, 11 May 2017 19:30:53 +0000 (21:30 +0200)]
Fix bug in matrix free thread graph creation.

7 years agoadd an assert in p::d::Tria::load() that the file exists 4371/head
Denis Davydov [Thu, 11 May 2017 12:58:23 +0000 (14:58 +0200)]
add an assert in p::d::Tria::load() that the file exists

7 years agoMerge pull request #4368 from kostyfisik/disc-nt
Wolfgang Bangerth [Wed, 10 May 2017 19:42:49 +0000 (13:42 -0600)]
Merge pull request #4368 from kostyfisik/disc-nt

add note on discontinuous coefficient

7 years agoadd note on discontinuous coefficient 4368/head
Konstantin Ladutenko [Wed, 10 May 2017 18:09:23 +0000 (21:09 +0300)]
add note on discontinuous coefficient

7 years agoMerge pull request #4365 from danshapero/constraints-move
Denis Davydov [Wed, 10 May 2017 15:58:54 +0000 (17:58 +0200)]
Merge pull request #4365 from danshapero/constraints-move

Added default move operations to ConstraintMatrix

7 years agoMerge pull request #4360 from masterleinad/fix_tests_after_trilinos_functions
Daniel Arndt [Wed, 10 May 2017 08:56:42 +0000 (10:56 +0200)]
Merge pull request #4360 from masterleinad/fix_tests_after_trilinos_functions

Fix tests after removal of deprecated functions in TrilinosWrappers vectors

7 years agoMerge pull request #4364 from drwells/remove-custom-sort
Denis Davydov [Wed, 10 May 2017 07:05:46 +0000 (09:05 +0200)]
Merge pull request #4364 from drwells/remove-custom-sort

Get rid of a custom sort implementation.

7 years agoAdded default move operations to ConstraintMatrix 4365/head
danshapero [Wed, 10 May 2017 02:48:58 +0000 (19:48 -0700)]
Added default move operations to ConstraintMatrix

7 years agoGet rid of a custom sort implementation. 4364/head
David Wells [Wed, 10 May 2017 01:50:19 +0000 (21:50 -0400)]
Get rid of a custom sort implementation.

This sorting function is about 10% faster for very large grids (O(10^7)
cell error indicators) but otherwise has the same performance as
std::sort. This patch replaces this with std::sort and a custom
comparator. To see the performance change, try running:

#include <algorithm>
#include <chrono>
#include <iostream>
#include <random>
#include <vector>

template <typename T>
void qsort_index (const std::vector<T>     &a,
                  std::vector<std::size_t> &ind,
                  std::size_t               l,
                  std::size_t               r)
{
  std::size_t i,j;
  T v;

  if (r<=l)
    return;

  v = a[ind[r]];
  i = l-1;
  j = r;
  do
    {
      do
        {
          ++i;
        }
      while ((a[ind[i]]>v) && (i<r));
      do
        {
          --j;
        }
      while ((a[ind[j]]<v) && (j>0));

      if (i<j)
        std::swap (ind[i], ind[j]);
      else
        std::swap (ind[i], ind[r]);
    }
  while (i<j);
  if (i > 0)
    {
      qsort_index(a,ind,l,i-1);
    }
  qsort_index(a,ind,i+1,r);
}

int main()
{
  // switch to length = 10000000 to see timing information
  constexpr std::size_t length = 20;
  std::vector<std::size_t> indices(length);
  std::iota(indices.begin(), indices.end(), std::size_t(0));

  std::uniform_int_distribution<std::size_t> unif(0, length);
  std::default_random_engine re;

  std::vector<std::size_t> values;

  for (std::size_t index = 0; index < indices.size(); ++index)
    {
      values.push_back(unif(re));
    }

  // for (std::size_t index = 0; index < length; ++index)
  //   {
  //     std::cout << index << ": "
  //               << indices[index] << ": "
  //               << values[indices[index]] << '\n';
  //   }

  {
    auto v = values;
    auto i = indices;

    const auto t0 = std::chrono::high_resolution_clock::now();
    qsort_index(v, i, 0, length - 1);
    const auto t1 = std::chrono::high_resolution_clock::now();
    std::cout << "milliseconds:"
              << std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0).count()
              << std::endl;

    std::cout << "\nafter qsort_index:\n";
    // for (std::size_t index = 0; index < length; ++index)
    //   {
    //     std::cout << index << ": "
    //               << i[index] << ": "
    //               << v[i[index]] << '\n';
    //   }
  }

  {
    auto v = values;
    auto i = indices;

    const auto t0 = std::chrono::high_resolution_clock::now();
    std::sort(i.begin(), i.end(), [&](const std::size_t left,
                                      const std::size_t right)
              {
                return v[left] >= v[right];
              });
    const auto t1 = std::chrono::high_resolution_clock::now();
    std::cout << "milliseconds:"
              << std::chrono::duration_cast<std::chrono::milliseconds>(t1 - t0).count()
              << std::endl;

    std::cout << "\nafter std::sort:\n";
    // for (std::size_t index = 0; index < length; ++index)
    //   {
    //     std::cout << index << ": "
    //               << i[index] << ": "
    //               << v[i[index]] << '\n';
    //   }
  }
}


In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.