Commit 71a4c5cd authored by Kirill Terekhov's avatar Kirill Terekhov

Fixes and features

Separated incident_matrix class from modify.cpp into stand alone hpp.

Finished  volume calculation algorithm for non-convex polyhedra in
incident_matrix class.

Fixed compilation error with ecl format reader.

Fixed compilation warning with class stored_variable.
parent fa5b300b
......@@ -29,6 +29,7 @@
#if defined(USE_AUTODIFF)
namespace INMOST
{
class basic_expression
{
......@@ -115,6 +116,7 @@ namespace INMOST
return value != value;
}
};
#if defined(PACK_ARRAY)
#pragma pack(push,r1,4)
......@@ -333,6 +335,8 @@ namespace INMOST
{
return 1 + v[0].first;
}
friend class multivar_expression_reference;
};
#if defined(PACK_ARRAY)
......@@ -353,6 +357,9 @@ namespace INMOST
/// Copy constructor, sets links to the same reference of value and entries
multivar_expression_reference(const multivar_expression_reference & other)
: value(other.value), entries(other.entries) {}
/// Copy constructor from multivar_expression, sets links to the same reference of value and entries
multivar_expression_reference(multivar_expression & other)
: value(other.value), entries(&other.entries) {}
/// Retrive value
__INLINE INMOST_DATA_REAL_TYPE GetValue() const { return value; }
/// Set value without changing derivatives
......@@ -507,7 +514,7 @@ namespace INMOST
return false;
}
};
template<class A>
class const_multiplication_expression : public shell_expression<const_multiplication_expression<A> >
......
......@@ -326,7 +326,7 @@ namespace INMOST
abstract_dynamic_variable * Copy() const {return static_cast<abstract_dynamic_variable *>(new static_variable(*this));}
};
class stored_variable : public shell_dynamic_variable<multivar_expression,stored_variable>
class stored_variable : public shell_dynamic_variable<multivar_expression_reference,stored_variable>
{
private:
Tag variable_tag;
......@@ -349,6 +349,7 @@ namespace INMOST
return e->VariableArray(variable_tag)[comp].GetValue();
else if( variable_tag.GetDataType() == DATA_REAL )
return e->RealArray(variable_tag)[comp];
else throw NotImplemented;
}
multivar_expression Variable(const Storage & e) const
{
......@@ -356,13 +357,15 @@ namespace INMOST
return e->VariableArray(variable_tag)[comp];
else if( variable_tag.GetDataType() == DATA_REAL )
return variable(e->RealArray(variable_tag)[comp]);
else throw NotImplemented;
}
multivar_expression operator [](const Storage & e) const
multivar_expression_reference operator [](const Storage & e) const
{
if( variable_tag.GetDataType() == DATA_VARIABLE )
return e->VariableArray(variable_tag)[comp];
else if( variable_tag.GetDataType() == DATA_REAL )
return variable(e->RealArray(variable_tag)[comp]);
return multivar_expression_reference(e->RealArray(variable_tag)[comp],NULL);
else throw NotImplemented;
}
Tag VariableTag() {return variable_tag;}
void GetVariation(const Storage & e, Sparse::Row & r) const { (*this)[e].GetJacobian(1.0,r); }
......
......@@ -3,9 +3,19 @@
#endif
#include "inmost.h"
#include "../Mesh/incident_matrix.hpp"
#if defined(USE_MESH)
// coords/zcorn algorithm
// 1) put all block nodes into pillars, sort each pillar nodes by actual depth
// 2) create edges down along pillars and mark them according to blocks
// 3) consider all pairs of pillars in Oxz and Oyz planes and create uncut block edges, mark them in block numbers
// 4) use line-sweep algorithm to intersect and cut all the edges between each pair of pillars, mark them in block numbers
// 5) mark all the nodes with block numbers that they belong by considering union of block numbers on adjacent edges
// 5) use incident_matrix algorithm to create all the faces between pair of pillars from pillar edges and inter-pillar edges
// 6) from intersection of block numbers on nodes figure out which blocks the face belongs
// 7) add top and bottom interface
//eclipse states
#define ECLSTRCMP(x,y) strncmp(x,y,8)
......@@ -88,7 +98,7 @@ namespace INMOST
class position_less
{
public:
bool operator()(const position & a, const position & b)
bool operator()(const position & a, const position & b) const
{
for(int k = 0; k < 3; ++k)
{
......@@ -104,7 +114,7 @@ namespace INMOST
class event_less
{
public:
bool operator()(const std::pair<double, int> & a, const std::pair<double, int> & b)
bool operator()(const std::pair<double, int> & a, const std::pair<double, int> & b) const
{
if (a.first < b.first - 1.0e-9)
return true;
......
......@@ -18,5 +18,6 @@ set(SOURCE
set(HEADER
${HEADER}
${CMAKE_CURRENT_SOURCE_DIR}/incident_matrix.hpp
PARENT_SCOPE
)
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment