Commit Graph

39 Commits

Author SHA1 Message Date
Markus Blatt
67d5a1f503 Prevents initializing std::shared_ptr from nullptr.
For g++-4.4 support for nullptr is not complete. Using it
to initialize an empty shared_ptr breaks compilation:

/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp: In constructor ‘Opm::HelperOps::HelperOps(const Grid&, Opm::EclipseStateConstPtr)’:
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: error: no match for ternary ‘operator?:’ in ‘(bool)eclState ? eclState->.Opm::EclipseState::getNNC() : nullptr’
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: note: candidates are: operator?:(bool, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*) <built-in>
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/AutoDiffHelpers.hpp:87: note:                 operator?:(bool, const Opm::NNC* std::__shared_ptr<const Opm::NNC, (__gnu_cxx::_Lock_policy)2u>::*, T*) <built-in>

Here no conversion to shared_ptr happens.

/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/ImpesTPFAAD.cpp: In constructor ‘Opm::HelperOps::HelperOps(const Grid&, Opm::EclipseStateConstPtr) [with Grid = UnstructuredGrid]’:
/home/mblatt/src/dune/opm/opm-autodiff/opm/autodiff/ImpesTPFAAD.cpp:160: error: no matching function for call to ‘std::shared_ptr<const Opm::EclipseState>::shared_ptr(const dune_nullptr_t&)’
/usr/include/c++/4.4/bits/shared_ptr.h:1263: note: candidates are: std::shared_ptr<_Tp>::shared_ptr(std::shared_ptr<_Tp>&&) [with _Tp = const Opm::EclipseState]
/usr/include/c++/4.4/bits/shared_ptr.h:1238: note:                 std::shared_ptr<_Tp>::shared_ptr() [with _Tp = const Opm::EclipseState]
/usr/include/c++/4.4/bits/shared_ptr.h:1236: note:                 std::shared_ptr<const Opm::EclipseState>::shared_ptr(const std::shared_ptr<const Opm::EclipseState>&)

Here the DUNE's nullptr implementation is used with std::shared_ptr which are not
compatible.

We fix this by using the emptry constructor of std::shared_ptr to create a nullptr.
2015-07-23 15:33:45 +02:00
Atgeirr Flø Rasmussen
de2a52bbda Fixed Eigen array dimensions must be respected in resize(). 2015-07-15 13:26:34 +02:00
Atgeirr Flø Rasmussen
61b1a67140 Bugfix: do not call method on pointer that can be null. 2015-07-13 11:24:21 +02:00
Atgeirr Flø Rasmussen
eda6899571 Simplify rhs of conditional. 2015-07-13 11:23:56 +02:00
Tor Harald Sandve
ab872b15e3 Remove old constructor
Pass Null pointer as default argument for the EclipseState to enable all
users to use the new constructor.
2015-07-10 10:30:29 +02:00
Tor Harald Sandve
662849637c Change size_t to int to avoid comparison warnings
and add some white spaces
2015-07-10 05:08:04 +02:00
Tor Harald Sandve
f1e91b8b87 Use the gridhelpers to make it run with cp-grid 2015-07-09 12:18:52 +02:00
Tor Harald Sandve
065b2f595c Add support for NNC in the simulator
1) NNC are added the grad, div and average operators
2) NNC are added the upwindSelector
3) NNC transmissibilities are added to the face transmissibilities
2015-07-09 12:15:59 +02:00
Atgeirr Flø Rasmussen
eb9b62697e Make vertcatCollapseJacs() handle constants properly.
With this, any or all of the input vector element may have
an empty jacobian vector. Any element with a non-empty
jacobian vector must still have the same block pattern.
2015-03-24 09:48:31 +01:00
Atgeirr Flø Rasmussen
07258f0249 Add function vertcatCollapsJacs(). 2015-03-20 11:19:42 +01:00
Atgeirr Flø Rasmussen
04b255a03f Make more use of move semantics in AD code.
This makes some API changes to AutoDiffBlock.
 - Add overload for the constant() constructor taking rvalue ref.
 - Add overload for the variable() constructor taking rvalue ref.
 - Make the function() constructor *require* rvalue refs.
 - Add a swap() function.

The remaining changes in this commit are follow-ups especially
to the third change (adding std::move in many places), and
some removal of unnecessary block pattern arguments from calls to
the constant() static method.
2015-03-16 14:22:32 +01:00
Robert K
efe8ee79f9 added collapseJacs method. 2014-12-02 12:39:21 +01:00
Robert K
2ac6a211b2 use correct types of SparseMatrices. 2014-12-02 12:39:21 +01:00
Atgeirr Flø Rasmussen
6c7061096a Improve performance of subset() and superset().
Using a different construction method for the sparse matrix
used makes the methods a little faster. There is probably
still room for improvement by refactoring to avoid the
sparse matrix products.
2014-09-25 11:38:48 +02:00
Markus Blatt
7127101c1c Makes distinction between functions more clear.
Currently, there are two abstract interface for the grids. One that
usually returns pods and arrays of them that also can be used by C
and is used also in opm-core, and one that returns Eigen datastructures
 needed within opm-autodiff.

This commit adds a postfix ToEigen to those functions (faceCells, and
cellCentroidsZ) one could imagine to also return pods and arrays of them.
This should at least resolve the confusion about the two faceCells functions.

The next step will be issue #192
Fixes #176
2014-08-28 14:44:13 +02:00
Andreas Lauser
756de358c0 implement multi-region PVT
this requires the multi-region PVT patch for opm-core
2014-05-13 13:39:26 +02:00
Bård Skaflestad
a784d50f1e Merge branch 'master' into blattms-master-refactor-for-cpgrid-support
Conflicts:
	examples/sim_fibo_ad.cpp
	opm/autodiff/FullyImplicitBlackoilSolver_impl.hpp

This brings the "CpGrid support" branch up to date with respect to
recent changes in opm-autodiff master.
2014-04-08 16:31:17 +02:00
Atgeirr Flø Rasmussen
6c4114ea69 Add more options for Selector class.
You can now choose which comparison to do for the indicator vector
to find when to choose the left argument. Only >= before (still default).
2014-04-01 15:49:01 +02:00
Markus Blatt
f4812c21eb Add an example program of FIBOS that uses CpGrid. 2014-03-13 16:33:36 +01:00
Markus Blatt
5112b8af26 Removes the dependency of FullyImpliciteBlackoilSolver onto UnstructuredGrid.
With these changes it will be possible to use CpGrid with FIBOS except for the
output routines.
2014-03-13 16:33:36 +01:00
Andreas Lauser
1c62934034 fix some clang 3.3 warnings
The most severe change probably is the removal of the AutoDiff
debugging helper functions which were useful from within a debugger
but unfortunately had to rely on a presumed linker bug in order not to
be removed in the final binary.

Also, some private attributes were unused. These have been removed and
the constructors of their respective classes have been adapted. Once
their intended functionality is actually implemented, they should be
brought back on an as-needed basis.

Thanks to @bska for the review!
2013-11-14 14:33:38 +01:00
Bård Skaflestad
8ad532c5b8 Fix warnings about "unused" parameters and typedefs.
CLang and recent GCC warn about the "typedef" 'OneColInt' in
AutoDiffHelpers.hpp being unused.  Similarly, GCC warns about unused
parameters in various place at level "-Wunused".  This change-set
either removes ('OneColInt') or suppresses those messages.
2013-09-26 19:21:45 +02:00
Atgeirr Flø Rasmussen
cc58bc3cef Fix minor issues pointed out by bska. 2013-09-23 13:02:56 +02:00
Atgeirr Flø Rasmussen
85f79c0e84 Rename AutoDiff::ForwardBlock -> Opm::AutoDiffBlock.
Also moved AutoDiffHelpers.hpp content to Opm namespace, and modified other
files as required by these two changes.
2013-09-19 12:53:28 +02:00
Atgeirr Flø Rasmussen
6e2cdfc33f Add helpers grad, fullngrad, fulldiv. 2013-09-18 14:32:09 +02:00
Andreas Lauser
0582ef08d8 explicitly include <iostream>
instead of relying on relying that some header includes it...
2013-09-05 12:28:16 +02:00
Andreas Lauser
a26483b51d Replace the ASSERT and ASSERT2 macros by assert 2013-09-03 15:27:08 +02:00
Atgeirr Flø Rasmussen
90f3886d20 Add sign() utility function. 2013-06-03 00:32:44 +02:00
Bård Skaflestad
bac1a3a364 Add a couple of debugging aids to assist in FIBO development. 2013-05-30 18:43:11 +02:00
Bård Skaflestad
d23a1c3066 Coalesce two adjacent '!NDEBUG' sections into one. 2013-05-30 17:56:49 +02:00
Atgeirr Flø Rasmussen
cd42d4af34 Added missing dereference operator. 2013-05-24 16:07:27 +02:00
Atgeirr Flø Rasmussen
535a1fd272 Added Span. 2013-05-24 15:38:19 +02:00
Bård Skaflestad
6d0202d529 collapseJacs(): Don't assume column-major ordering
The 'InnerIterator' is ordering agnostic, so there is no need to
assume that the Jacobians are stored in a particular ordering.
2013-05-22 11:26:49 +02:00
Atgeirr Flø Rasmussen
3929688756 Added utilitied collapseJacs() and vertcat().
The utilities are not optimized for speed, but make it easy
to construct a linear system from all the jacobian blocks.
2013-05-21 15:40:45 +02:00
Atgeirr Flø Rasmussen
4d794b79dc Added Selector class.
Used to choose element-by-element between two (potentially AD) vectors,
depending on signs of elements of a third vector. Simple and not optimized.
2013-05-21 09:29:51 +02:00
Atgeirr Flø Rasmussen
defae7b96d Moved UpwindSelector out of anonymous namespace. 2013-05-21 09:28:54 +02:00
Atgeirr Flø Rasmussen
84d163e9fa Bugfix: convert array to matrix type for matrix multiply. 2013-05-16 14:44:16 +02:00
Bård Skaflestad
e0c85a2fdb Adapt to CMake-based build system.
Specifically,

  - #include <config.h> where appropriate (all .cpp files)
  - Adjust include statements to account for sub-directory locations
    of .hpp files.
2013-05-15 16:10:20 +02:00
Bård Skaflestad
9309024d1e First partitioning into source/examples/tests
Reorganisations are likely.
2013-05-15 10:35:39 +02:00