Permalink
Browse files

Fix compilation with USE_AUTODIFF=OFF

Thanks to Matvey Kraposhin
  • Loading branch information...
kirill-terekhov committed Jun 1, 2018
1 parent f518784 commit 1e58380d99eab9f5669315e8e055ffa630dbc033
@@ -1693,10 +1693,19 @@ void draw_screen()
{
if (source_tag.isDefined(visualization_type))
{
if (source_tag.GetDataType() == DATA_REAL || source_tag.GetDataType() == DATA_INTEGER || source_tag.GetDataType() == DATA_BULK || source_tag.GetDataType() == DATA_VARIABLE)
if (source_tag.GetDataType() == DATA_REAL ||
source_tag.GetDataType() == DATA_INTEGER ||
source_tag.GetDataType() == DATA_BULK
#if defined(USE_AUTODIFF)
||
source_tag.GetDataType() == DATA_VARIABLE
#endif
)
{
#if defined(USE_AUTODIFF)
if (source_tag.GetDataType() == DATA_VARIABLE)
printf("I can show only value for data of type variable\n");
#endif
float min = 1.0e20, max = -1.0e20;
printf("prepearing data for visualization\n");
if (visualization_tag.isValid())
@@ -1760,6 +1769,7 @@ void draw_screen()
}
else val += wgt * static_cast<double>(v[comp]);
}
#if defined(USE_AUTODIFF)
else if (source_tag.GetDataType() == DATA_VARIABLE)
{
Storage::var_array v = jt->VariableArray(source_tag);
@@ -1772,6 +1782,7 @@ void draw_screen()
}
else val += wgt * static_cast<double>(v[comp].GetValue());
}
#endif
vol += wgt;
}
res = val / vol;
@@ -1832,6 +1843,7 @@ void draw_screen()
}
else val += wgt * static_cast<double>(v[comp]);
}
#if defined(USE_AUTODIFF)
else if (source_tag.GetDataType() == DATA_VARIABLE)
{
Storage::var_array v = jt->VariableArray(source_tag);
@@ -1844,6 +1856,7 @@ void draw_screen()
}
else val += wgt * v[comp].GetValue();
}
#endif
vol += wgt;
}
res = val / vol;
@@ -1,5 +1,5 @@
#include "inmost_model.h"
#if defined(USE_AUTODIFF) && defined(USE_MESH) && defined(USE_SOLVER)
namespace INMOST
{
@@ -273,3 +273,4 @@ namespace INMOST
return ret;
}
}
#endif
@@ -2283,6 +2283,9 @@ __INLINE INMOST_DATA_REAL_TYPE get_table(INMOST_DATA_RE
#else //USE_AUTODIFF
__INLINE bool check_nans(INMOST_DATA_REAL_TYPE val) {return val != val;}
__INLINE bool check_infs(INMOST_DATA_REAL_TYPE val) {return std::isinf(val);}
__INLINE bool check_nans_infs(INMOST_DATA_REAL_TYPE val) {return check_nans(val) || check_infs(val);}
__INLINE void assign(INMOST_DATA_INTEGER_TYPE & Arg, INMOST_DATA_INTEGER_TYPE Val) {Arg = Val;}
__INLINE void assign(INMOST_DATA_INTEGER_TYPE & Arg, INMOST_DATA_REAL_TYPE Val) {Arg = Val;}
__INLINE void assign(INMOST_DATA_REAL_TYPE & Arg, INMOST_DATA_INTEGER_TYPE Val) {Arg = Val;}
@@ -17,11 +17,12 @@ namespace INMOST
class NonlinearSolver
{
Automatizator & aut;
//Automatizator & aut;
public:
NonlinearSolver(Automatizator & aut) : aut(aut) {}
NonlinearSolver(const NonlinearSolver & b) : aut(b.aut) {}
NonlinearSolver & operator =(NonlinearSolver const & b) {aut = b.aut; return *this;}
//NonlinearSolver(Automatizator & aut) : aut(aut) {}
NonlinearSolver() {}
NonlinearSolver(const NonlinearSolver & b) /*: aut(b.aut)*/ {}
NonlinearSolver & operator =(NonlinearSolver const & b) {/*aut = b.aut;*/ return *this;}
~NonlinearSolver() {}
RequestedAction GetAction() const;
@@ -3,7 +3,7 @@
#include "inmost_variable.h"
#if defined(USE_AUTODIFF) && defined(USE_MESH)
#if defined(USE_AUTODIFF) && defined(USE_MESH) && defined(USE_SOLVER)
namespace INMOST
{
View
@@ -2334,12 +2334,14 @@ namespace INMOST
//array_data_send.resize(had_s+s*tag.GetBytesSize());
if( s )
{
#if defined(USE_AUTODIFF)
if( tag.GetDataType() == DATA_VARIABLE )
{
REPORT_VAL("data size: ", s);
REPORT_VAL("data capacity: ", GetDataCapacity(*eit,tag));
REPORT_VAL("array size: ", had_s);
}
#endif
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
GetData(*eit,tag,0,s,&array_data_send[had_s]);
//REPORT_VAL("size",s);
@@ -2364,13 +2366,15 @@ namespace INMOST
//array_data_send.resize(had_s+s*tag.GetBytesSize());
if( s )
{
#if defined(USE_AUTODIFF)
if( tag.GetDataType() == DATA_VARIABLE )
{
REPORT_VAL("on element ",Element(this,*eit).GlobalID());
REPORT_VAL("position: ", had_s);
REPORT_VAL("data capacity: ", GetDataCapacity(*eit,tag));
REPORT_VAL("size: ", s);
}
#endif
array_data_send.resize(had_s+GetDataCapacity(*eit,tag));
if (tag.GetDataType() == DATA_REFERENCE)
{
@@ -2630,13 +2634,15 @@ namespace INMOST
{
if( !select || GetMarker(*eit,select) )
{
#if defined(USE_AUTODIFF)
if( tag.GetDataType() == DATA_VARIABLE )
{
REPORT_VAL("on element ",Element(this,*eit).GlobalID());
REPORT_VAL("position ", pos);
REPORT_VAL("capacity ", GetDataCapacity(&array_data_recv[pos],size,tag));
REPORT_VAL("size ", size);
}
#endif
op(tag,Element(this,*eit),&array_data_recv[pos],size);
pos += GetDataCapacity(&array_data_recv[pos],size,tag);
//pos += size*tag.GetBytesSize();

0 comments on commit 1e58380

Please sign in to comment.