Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
INMOST
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kirill Terekhov
INMOST
Commits
359312ab
Commit
359312ab
authored
Sep 02, 2016
by
Igor Konshin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Small changes to avoid warnings for MS and Intel compilers
parent
5156345a
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
65 additions
and
57 deletions
+65
-57
Source/Headers/inmost_data.h
Source/Headers/inmost_data.h
+3
-3
Source/Headers/inmost_expression.h
Source/Headers/inmost_expression.h
+5
-5
Source/Headers/inmost_variable.h
Source/Headers/inmost_variable.h
+2
-2
Source/IO/mesh_vtk_file.cpp
Source/IO/mesh_vtk_file.cpp
+4
-4
Source/Mesh/geometry.cpp
Source/Mesh/geometry.cpp
+2
-2
Source/Mesh/mesh.cpp
Source/Mesh/mesh.cpp
+2
-1
Source/Mesh/parallel.cpp
Source/Mesh/parallel.cpp
+7
-1
Source/Misc/xml.cpp
Source/Misc/xml.cpp
+2
-2
Source/Solver/solver_fcbiilu2.cpp
Source/Solver/solver_fcbiilu2.cpp
+28
-27
Source/Solver/solver_fcbiilu2.h
Source/Solver/solver_fcbiilu2.h
+1
-1
Source/Solver/solver_petsc.cpp
Source/Solver/solver_petsc.cpp
+5
-5
Source/Solver/sparse.cpp
Source/Solver/sparse.cpp
+4
-4
No files found.
Source/Headers/inmost_data.h
View file @
359312ab
...
...
@@ -557,9 +557,9 @@ namespace INMOST
/// Copy part of the associated array or data to the destination memory.
/// @param tag Identifying Tag.
/// @param shift Starting position of the copied data.
/// For abstact data
number of bytes to skip, otherwise number of values to skip.
/// For abstact data -
number of bytes to skip, otherwise number of values to skip.
/// @param size Number of elements to copy.
/// For abstact data
number of bytes to copy, otherwise number of values to copy.
/// For abstact data -
number of bytes to copy, otherwise number of values to copy.
/// @param data Destination position to copy data to.
/// @see Storage::SetData
__INLINE
void
GetData
(
const
Tag
&
tag
,
...
...
@@ -741,4 +741,4 @@ namespace INMOST
#endif //INMOST_DATA_H_INCLUDED
\ No newline at end of file
#endif //INMOST_DATA_H_INCLUDED
Source/Headers/inmost_expression.h
View file @
359312ab
...
...
@@ -34,7 +34,7 @@ namespace INMOST
{
public:
basic_expression
()
{}
//if( GetAutodiffPrint() ) std::cout << this << " Created" << std::endl;}
basic_expression
(
const
basic_expression
&
other
)
{};
//std::cout << this << " Created from " << &other << std::endl;}
basic_expression
(
const
basic_expression
&
other
)
{
(
void
)
other
;
};
//std::cout << this << " Created from " << &other << std::endl;}
virtual
INMOST_DATA_REAL_TYPE
GetValue
()
const
=
0
;
virtual
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
=
0
;
virtual
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
=
0
;
...
...
@@ -74,9 +74,9 @@ namespace INMOST
const_expression
(
const
const_expression
&
other
)
:
value
(
other
.
value
)
{}
const_expression
(
INMOST_DATA_REAL_TYPE
pvalue
)
:
value
(
pvalue
)
{}
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
value
;
}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{}
__INLINE
void
GetHessian
(
INMOST_DATA_REAL_TYPE
multJ
,
Sparse
::
Row
&
J
,
INMOST_DATA_REAL_TYPE
multH
,
Sparse
::
HessianRow
&
H
)
const
{}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
(
void
)
mult
;
(
void
)
r
;
}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
(
void
)
mult
;
(
void
)
r
;
}
__INLINE
void
GetHessian
(
INMOST_DATA_REAL_TYPE
multJ
,
Sparse
::
Row
&
J
,
INMOST_DATA_REAL_TYPE
multH
,
Sparse
::
HessianRow
&
H
)
const
{
(
void
)
multJ
;
(
void
)
J
;
(
void
)
multH
;
(
void
)
H
;
}
__INLINE
const_expression
&
operator
=
(
const_expression
const
&
other
)
{
value
=
other
.
value
;
...
...
@@ -97,7 +97,7 @@ namespace INMOST
__INLINE
INMOST_DATA_REAL_TYPE
GetValue
()
const
{
return
value
;
}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
RowMerger
&
r
)
const
{
if
(
index
!=
ENUMUNDEF
)
r
[
index
]
+=
mult
;}
__INLINE
void
GetJacobian
(
INMOST_DATA_REAL_TYPE
mult
,
Sparse
::
Row
&
r
)
const
{
if
(
index
!=
ENUMUNDEF
)
r
[
index
]
+=
mult
;}
__INLINE
void
GetHessian
(
INMOST_DATA_REAL_TYPE
multJ
,
Sparse
::
Row
&
J
,
INMOST_DATA_REAL_TYPE
multH
,
Sparse
::
HessianRow
&
H
)
const
{
if
(
index
!=
ENUMUNDEF
)
J
.
Push
(
index
,
multJ
);}
__INLINE
void
GetHessian
(
INMOST_DATA_REAL_TYPE
multJ
,
Sparse
::
Row
&
J
,
INMOST_DATA_REAL_TYPE
multH
,
Sparse
::
HessianRow
&
H
)
const
{
if
(
index
!=
ENUMUNDEF
)
J
.
Push
(
index
,
multJ
);
(
void
)
multH
;
(
void
)
H
;
}
__INLINE
var_expression
&
operator
=
(
var_expression
const
&
other
)
{
value
=
other
.
value
;
...
...
Source/Headers/inmost_variable.h
View file @
359312ab
...
...
@@ -341,7 +341,7 @@ namespace INMOST
Tag
ValueTag
()
{
return
value_tag
;}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
bool
isUnknown
(
const
Storage
&
e
)
const
{
return
false
;}
bool
isUnknown
(
const
Storage
&
e
)
const
{
(
void
)
e
;
return
false
;}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
static_variable
(
*
this
));}
};
...
...
@@ -389,7 +389,7 @@ namespace INMOST
Tag
VariableTag
()
{
return
variable_tag
;}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
Row
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
void
GetVariation
(
const
Storage
&
e
,
Sparse
::
RowMerger
&
r
)
const
{
(
*
this
)[
e
].
GetJacobian
(
1.0
,
r
);
}
bool
isUnknown
(
const
Storage
&
e
)
const
{
return
false
;}
bool
isUnknown
(
const
Storage
&
e
)
const
{
(
void
)
e
;
return
false
;}
abstract_dynamic_variable
*
Copy
()
const
{
return
static_cast
<
abstract_dynamic_variable
*>
(
new
stored_variable
(
*
this
));}
};
...
...
Source/IO/mesh_vtk_file.cpp
View file @
359312ab
...
...
@@ -27,10 +27,10 @@
#define R_QUIT 100
int
isnan
(
double
x
)
{
return
x
!=
x
;
}
//int isinf(double x) { return !isnan(x) && isnan(x - x); }
int
isinf
(
double
x
)
{
return
fabs
(
x
)
>
DBL_MAX
;
}
int
isbad
(
double
x
)
{
return
isnan
(
x
)
||
isinf
(
x
);
}
static
int
isnan
(
double
x
)
{
return
x
!=
x
;
}
//
static
int isinf(double x) { return !isnan(x) && isnan(x - x); }
static
int
isinf
(
double
x
)
{
return
fabs
(
x
)
>
DBL_MAX
;
}
static
int
isbad
(
double
x
)
{
return
isnan
(
x
)
||
isinf
(
x
);
}
template
<
typename
T
>
void
ReadCoords
(
FILE
*
f
,
INMOST_DATA_REAL_TYPE
c
[
3
])
...
...
Source/Mesh/geometry.cpp
View file @
359312ab
...
...
@@ -1165,7 +1165,7 @@ namespace INMOST
bool
Face
::
CheckNormalOrientation
()
const
{
Mesh
*
mesh
=
GetMeshLink
();
integer
dim
=
mesh
->
GetDimensions
();
//
integer dim = mesh->GetDimensions();
Cell
c1
=
BackCell
();
if
(
c1
.
isValid
()
)
{
...
...
@@ -1270,7 +1270,7 @@ namespace INMOST
cnt
[
r
]
=
cnt
[
r
]
-
ccnt
[
r
];
measure
+=
(
data
[
j
]
->
GetPrivateMarker
(
rev
)
?
-
1.0
:
1.0
)
*
vec_dot_product
(
cnt
,
nrm
,
3
);
}
bool
have_rev
=
cur
->
GetPrivateMarker
(
rev
);
//
bool have_rev = cur->GetPrivateMarker(rev);
data
.
RemPrivateMarker
(
rev
);
mesh
->
ReleasePrivateMarker
(
rev
);
if
(
(
measure
<
0
))
// && !have_rev) || (measure > 0 && have_rev))
...
...
Source/Mesh/mesh.cpp
View file @
359312ab
...
...
@@ -2029,7 +2029,7 @@ namespace INMOST
else
return
reference_array
(
this
,
static_cast
<
reference
*>
(
p
),
tag
.
GetSize
());
}
Storage
::
remote_reference_array
Mesh
::
RemoteReferenceArray
(
HandleType
h
,
const
Tag
&
tag
)
Storage
::
remote_reference_array
Mesh
::
RemoteReferenceArray
(
HandleType
h
,
const
Tag
&
tag
)
{
Asserts
(
h
,
tag
,
DATA_REMOTE_REFERENCE
);
void
*
p
=
MGetLink
(
h
,
tag
);
...
...
@@ -2061,6 +2061,7 @@ namespace INMOST
assert
(
this
==
tag
.
GetMeshLink
());
//tag is not mine
assert
(
tag
.
GetDataType
()
==
expected
);
//tag data type coinside with expected data type
assert
(
tag
.
isDefinedByDim
(
GetHandleElementNum
(
h
)));
//tag data type coinside with expected data type
(
void
)
h
;
(
void
)
tag
;
(
void
)
expected
;
//due to __INLINE these variables considered by compilers as unreferenced
}
void
Mesh
::
ClearMarkerSpace
(
HandleType
h
)
...
...
Source/Mesh/parallel.cpp
View file @
359312ab
...
...
@@ -379,7 +379,8 @@ namespace INMOST
memcpy
(
temp
.
data
(),
input
,
sizeof
(
Storage
::
real
)
*
size
);
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_REAL_TYPE
,
MPI_SUM
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
@@ -392,6 +393,7 @@ namespace INMOST
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_INTEGER_TYPE
,
MPI_SUM
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
@@ -454,6 +456,7 @@ namespace INMOST
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_REAL_TYPE
,
MPI_MAX
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
@@ -466,6 +469,7 @@ namespace INMOST
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_INTEGER_TYPE
,
MPI_MAX
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
@@ -500,6 +504,7 @@ namespace INMOST
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_REAL_TYPE
,
MPI_MIN
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
@@ -512,6 +517,7 @@ namespace INMOST
MPI_Allreduce
(
temp
.
data
(),
input
,
size
,
INMOST_MPI_DATA_INTEGER_TYPE
,
MPI_MIN
,
comm
);
#else//USE_MPI
(
void
)
input
;
(
void
)
size
;
#endif//USE_MPI
}
...
...
Source/Misc/xml.cpp
View file @
359312ab
...
...
@@ -302,8 +302,8 @@ namespace INMOST
std
::
istream
&
XMLReader
::
get_iStream
()
{
return
*
inp
.
back
().
s
;}
const
std
::
istream
&
XMLReader
::
get_iStream
()
const
{
return
*
inp
.
back
().
s
;}
XMLReader
::
XMLReader
(
const
XMLReader
&
other
)
{
}
XMLReader
&
XMLReader
::
operator
=
(
XMLReader
&
other
)
{
return
*
this
;}
XMLReader
::
XMLReader
(
const
XMLReader
&
other
)
{(
void
)
other
;
}
XMLReader
&
XMLReader
::
operator
=
(
XMLReader
&
other
)
{(
void
)
other
;
return
*
this
;}
char
XMLReader
::
GetChar
()
{
...
...
Source/Solver/solver_fcbiilu2.cpp
View file @
359312ab
...
...
@@ -10,6 +10,7 @@
#include <math.h>
#include <string>
#define T(x) // x // Trace of function calls. Use: "T(x) x" for trace and "T(x)" for silence
static
int
set_kovl
=
0
;
// number of overlap layers: kovl=0,1,2,...
static
double
set_tau
=
3e-3
;
// the ILU2 precision (for the submatrix factorization); tau=3e-3
...
...
@@ -121,7 +122,7 @@ static int newmatrixbcg(bcg *s, matrix *A, bool same_precond)
if
(
!
same_precond
)
{
//do nothing...
//std::cout<<"##### inside newmatrixbcg bef. renewbcg \n";
//db!
T
(
std
::
cout
<<
"##### inside newmatrixbcg bef. renewbcg
\n
"
;)
//db!
return
renewbcg
(
s
,
A
->
A
);
}
else
return
0
;
...
...
@@ -132,7 +133,7 @@ static int newmatrixbcg(bcg *s, matrix *A, bool same_precond)
int
initbcg
(
bcg
*
s
,
matrix
*
A
,
double
eps
)
{
s
->
eps
=
eps
;
//std::cout<<"##### inside initbcg bef. newmatrixbcg eps="<<eps<<" \n";
//db!
T
(
std
::
cout
<<
"##### inside initbcg bef. newmatrixbcg eps="
<<
eps
<<
"
\n
"
;)
//db!
return
newmatrixbcg
(
s
,
A
,
false
);
}
...
...
@@ -152,17 +153,17 @@ int renewbcg(bcg *s, double *A)
if
(
s
->
W
)
free
(
s
->
W
);
s
->
W
=
NULL
;
int
ierr
=
0
;
//std::cout<<"##### inside renewbcg bef. biilu2_bcg\n";
//db!
T
(
std
::
cout
<<
"##### inside renewbcg bef. biilu2_bcg
\n
"
;)
//db!
double
*
B
=
(
double
*
)
malloc
(
sizeof
(
double
)
*
s
->
n
);
//db!!!!!!!!!!!!!!
//double *X = (double*) malloc(sizeof(double)*s->n); //db!!!!!!!!!!!!!!
biilu2_bcg
(
s
->
ibl
,
s
->
ia
,
s
->
ja
,
s
->
a
,
//B, X, //!!!!!KAPORIN!!!!!!!!!!!!!
B
,
NULL
,
//!!!!!KAPORIN!!!!!!!!!!!!
//NULL, NULL, //!!!!!INK!!!!!!!!!!!
job
,
&
s
->
len_r8
,
&
s
->
W
,
job
,
&
s
->
len_r8
,
&
s
->
W
,
s
->
kovl
,
s
->
tau
,
s
->
eps
,
maxit
,
s
->
msglev
,
&
ierr
,
s
->
istat
,
s
->
dstat
);
//std::cout<<"##### inside renewbcg aft. biilu2_bcg\n";
//db!
&
ierr
,
s
->
istat
,
s
->
dstat
);
T
(
std
::
cout
<<
"##### inside renewbcg aft. biilu2_bcg
\n
"
;)
//db!
free
(
B
);
//free(X);//db!!!!!!!!!!!!!!!
if
(
ierr
)
printf
(
"initialization of biilu2 failed, ierr=%d
\n
"
,
ierr
);
...
...
@@ -182,12 +183,12 @@ int solvebcg(bcg *s, vector *b, vector *x)
int
maxit
=
s
->
nit
;
int
ierr
=
0
;
//std::cout<<"##### inside solvebcg bef. biilu2_bcg\n";
//db!
T
(
std
::
cout
<<
"##### inside solvebcg bef. biilu2_bcg
\n
"
;)
//db!
biilu2_bcg
(
s
->
ibl
,
s
->
ia
,
s
->
ja
,
s
->
a
,
b
->
v
,
x
->
v
,
job
,
&
s
->
len_r8
,
&
s
->
W
,
job
,
&
s
->
len_r8
,
&
s
->
W
,
s
->
kovl
,
s
->
tau
,
s
->
eps
,
maxit
,
s
->
msglev
,
&
ierr
,
s
->
istat
,
s
->
dstat
);
//std::cout<<"##### inside solvebcg aft. biilu2_bcg\n";
//db!
&
ierr
,
s
->
istat
,
s
->
dstat
);
T
(
std
::
cout
<<
"##### inside solvebcg aft. biilu2_bcg
\n
"
;)
//db!
s
->
ITER
=
s
->
istat
[
2
];
s
->
RESID
=
s
->
dstat
[
2
];
...
...
@@ -258,7 +259,7 @@ void MatrixAssignDataFcbiilu2(void * pA, void * pB)
void
MatrixInitDataFcbiilu2
(
void
**
ppA
,
INMOST_MPI_Comm
comm
,
const
char
*
name
)
{
//std::cout<<"##### ins. MatrixInitDataFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. MatrixInitDataFcbiilu2
\n
"
;)
//db!
if
(
ppA
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
if
(
*
ppA
==
NULL
)
{
...
...
@@ -266,7 +267,7 @@ void MatrixInitDataFcbiilu2(void ** ppA, INMOST_MPI_Comm comm, const char * name
matrix
*
A
=
(
matrix
*
)
*
ppA
;
A
->
n
=
0
;
A
->
nproc
=
0
;
//std::cout<<"##### ins. MatrixInitDataFcbiilu2 n=nproc=0 \n";
//db!
T
(
std
::
cout
<<
"##### ins. MatrixInitDataFcbiilu2 n=nproc=0
\n
"
;)
//db!
}
(
void
)
comm
;
(
void
)
name
;
...
...
@@ -283,7 +284,7 @@ void MatrixDestroyDataFcbiilu2(void ** pA)
free
(
A
->
ia
);
free
(
A
->
ja
);
free
(
A
->
A
);
//std::cout<<"##### ins. MatrixDestroyDataFcbiilu2 ...free \n";
//db!
T
(
std
::
cout
<<
"##### ins. MatrixDestroyDataFcbiilu2 ...free
\n
"
;)
//db!
}
free
(
*
pA
);
*
pA
=
NULL
;
...
...
@@ -294,7 +295,7 @@ void MatrixDestroyDataFcbiilu2(void ** pA)
void
MatrixFillFcbiilu2
(
void
*
pA
,
int
size
,
int
nproc
,
int
*
ibl
,
int
*
ia
,
int
*
ja
,
double
*
values
)
{
//std::cout<<"##### ins. MatrixFillFcbiilu2 n="<<size<<" nproc="<<nproc<<" \n";
//db!
T
(
std
::
cout
<<
"##### ins. MatrixFillFcbiilu2 n="
<<
size
<<
" nproc="
<<
nproc
<<
"
\n
"
;)
//db!
if
(
pA
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
matrix
*
A
=
(
matrix
*
)
pA
;
A
->
n
=
size
;
...
...
@@ -307,7 +308,7 @@ void MatrixFillFcbiilu2(void * pA, int size, int nproc, int * ibl, int * ia, int
void
MatrixFillValuesFcbiilu2
(
void
*
pA
,
double
*
values
)
{
//std::cout<<"##### ins. MatrixFillValuesFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. MatrixFillValuesFcbiilu2
\n
"
;)
//db!
if
(
pA
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
matrix
*
A
=
(
matrix
*
)
pA
;
free
(
A
->
A
);
...
...
@@ -332,7 +333,7 @@ void VectorInitDataFcbiilu2(void ** ppA, INMOST_MPI_Comm comm, const char * name
void
VectorCopyDataFcbiilu2
(
void
**
ppA
,
void
*
pB
)
{
//std::cout<<"##### ins. VectorCopyDataFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. VectorCopyDataFcbiilu2
\n
"
;)
//db!
if
(
ppA
==
NULL
||
pB
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
*
ppA
=
malloc
(
sizeof
(
vector
));
vector
*
A
=
(
vector
*
)
*
ppA
;
...
...
@@ -347,7 +348,7 @@ void VectorCopyDataFcbiilu2(void ** ppA, void * pB)
void
VectorAssignDataFcbiilu2
(
void
*
pA
,
void
*
pB
)
{
//std::cout<<"##### ins. VectorAssignDataFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. VectorAssignDataFcbiilu2
\n
"
;)
//db!
vector
*
A
=
(
vector
*
)
pA
;
vector
*
B
=
(
vector
*
)
pB
;
if
(
A
==
NULL
||
B
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
...
...
@@ -403,12 +404,12 @@ void VectorDestroyDataFcbiilu2(void ** ppA)
void
SolverInitializeFcbiilu2
(
int
*
argc
,
char
***
argv
,
const
char
*
file_options
)
{
//std::cout<<"##### ins. SolverInitializeFcbiilu2 ("<<file_options<<") \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverInitializeFcbiilu2 ("
<<
file_options
<<
")
\n
"
;)
//db!
if
(
file_options
==
NULL
)
return
;
std
::
string
s
=
file_options
;
if
(
s
==
""
||
s
==
" "
)
return
;
std
::
ifstream
is
;
//std::cout<<"##### ins. SolverInitializeFcbiilu2: bef. open("<<file_options<<") \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverInitializeFcbiilu2: bef. open("
<<
file_options
<<
")
\n
"
;)
//db!
is
.
open
(
file_options
,
std
::
ifstream
::
in
);
if
(
s
==
"ctrl_dat"
)
{
getline
(
is
,
s
);
//1 skip ipart
...
...
@@ -428,7 +429,7 @@ void SolverInitializeFcbiilu2(int * argc, char *** argv, const char * file_optio
getline
(
is
,
s
);
sscanf
(
s
.
c_str
(),
"%d"
,
&
set_nit
);
//4 nit
getline
(
is
,
s
);
sscanf
(
s
.
c_str
(),
"%d"
,
&
set_msglev
);
//5 msglev
}
//std::cout<<"##### ins. SolverInitializeFcbiilu2: kovl="<<set_kovl<<" tau="<<set_tau<<" eps="<<set_eps<<" nit="<<set_nit<<" msglev="<<set_msglev<<" from: "<<file_options<<" \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverInitializeFcbiilu2: kovl="
<<
set_kovl
<<
" tau="
<<
set_tau
<<
" eps="
<<
set_eps
<<
" nit="
<<
set_nit
<<
" msglev="
<<
set_msglev
<<
" from: "
<<
file_options
<<
"
\n
"
;)
//db!
(
void
)
argc
;
(
void
)
argv
;
}
...
...
@@ -458,7 +459,7 @@ void SolverDestroyDataFcbiilu2(void ** data)
void
SolverInitDataFcbiilu2
(
void
**
data
,
INMOST_MPI_Comm
comm
,
const
char
*
name
)
{
//std::cout<<"##### ins. SolverInitDataFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverInitDataFcbiilu2
\n
"
;)
//db!
*
data
=
malloc
(
sizeof
(
bcg
));
((
bcg
*
)
*
data
)
->
n
=
0
;
((
bcg
*
)
*
data
)
->
nproc
=
0
;
...
...
@@ -485,24 +486,24 @@ void SolverAssignDataFcbiilu2(void * data, void * other_data)
void
SolverSetMatrixFcbiilu2
(
void
*
data
,
void
*
matrix_data
,
bool
same_pattern
,
bool
reuse_preconditioner
)
{
//std::cout<<"##### ins. SolverSetMatrixFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverSetMatrixFcbiilu2
\n
"
;)
//db!
bcg
*
m
=
(
bcg
*
)
data
;
matrix
*
A
=
(
matrix
*
)
matrix_data
;
//if( A == NULL) std::cout<<"##### A == NULL ... \n";
//db!
//if( m == NULL) std::cout<<"##### m == NULL ... \n";
//db!
T
(
if
(
A
==
NULL
)
std
::
cout
<<
"##### A == NULL ...
\n
"
;)
//db!
T
(
if
(
m
==
NULL
)
std
::
cout
<<
"##### m == NULL ...
\n
"
;)
//db!
if
(
A
==
NULL
||
m
==
NULL
)
throw
INMOST
::
DataCorruptedInSolver
;
//std::cout<<"##### ins. SolverSetMatrixFcbiilu2 bef. initbcg or newmatrixbcg \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverSetMatrixFcbiilu2 bef. initbcg or newmatrixbcg
\n
"
;)
//db!
if
(
m
->
n
==
0
)
initbcg
(
m
,
A
,
set_eps
);
else
newmatrixbcg
(
m
,
A
,
reuse_preconditioner
);
(
void
)
same_pattern
;
//std::cout<<"##### ins. SolverSetMatrixFcbiilu2 bef. return \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverSetMatrixFcbiilu2 bef. return
\n
"
;)
//db!
}
bool
SolverSolveFcbiilu2
(
void
*
data
,
void
*
rhs_data
,
void
*
sol_data
)
{
//std::cout<<"##### ins. SolverSolveFcbiilu2 \n";
//db!
T
(
std
::
cout
<<
"##### ins. SolverSolveFcbiilu2
\n
"
;)
//db!
bcg
*
m
=
(
bcg
*
)
data
;
vector
*
rhs
=
(
vector
*
)
rhs_data
,
*
sol
=
(
vector
*
)
sol_data
;
return
solvebcg
(
m
,
rhs
,
sol
)
==
0
;
...
...
Source/Solver/solver_fcbiilu2.h
View file @
359312ab
...
...
@@ -34,7 +34,7 @@ bool SolverSolveFcbiilu2(void * data, void * rhs_data, void * sol_data);
int
SolverIterationNumberFcbiilu2
(
void
*
data
);
double
SolverResidualNormFcbiilu2
(
void
*
data
);
void
SolverAddOtherStatFcbiilu2
(
void
*
data
,
unsigned
int
*
pivmod
,
double
*
prdens
,
double
*
t_prec
,
double
*
t_iter
);
//#endif //USE_
FCSOLVER_
BIILU2
//#endif //USE_
SOLVER_FC
BIILU2
#endif //SOLVER_FCBIILU2_H_INCLUDED
Source/Solver/solver_petsc.cpp
View file @
359312ab
...
...
@@ -59,7 +59,7 @@ void MatrixInitDataPetsc(void ** data, INMOST_MPI_Comm comm, const char * name)
MatrixDestroyDataPetsc
(
data
);
*
data
=
static_cast
<
void
*>
(
new
Mat
);
#if !defined(USE_MPI)
ierr
=
MatCreate
(
PETSC_COMM_WORLD
,
static_cast
<
Mat
*>
(
*
data
))
;
ierr
=
MatCreate
(
PETSC_COMM_WORLD
,
static_cast
<
Mat
*>
(
*
data
));
(
void
)
comm
;
#else
ierr
=
MatCreate
(
comm
,
static_cast
<
Mat
*>
(
*
data
));
#endif
...
...
@@ -137,7 +137,7 @@ void VectorInitDataPetsc(void ** data, INMOST_MPI_Comm comm, const char * name)
VectorDestroyDataPetsc
(
data
);
*
data
=
static_cast
<
void
*>
(
new
Vec
);
#if !defined(USE_MPI)
ierr
=
VecCreate
(
PETSC_COMM_WORLD
,
static_cast
<
Vec
*>
(
*
data
))
;
ierr
=
VecCreate
(
PETSC_COMM_WORLD
,
static_cast
<
Vec
*>
(
*
data
));
(
void
)
comm
;
#else
ierr
=
VecCreate
(
comm
,
static_cast
<
Vec
*>
(
*
data
));
#endif
...
...
@@ -218,7 +218,7 @@ void SolverInitDataPetsc(void ** data, INMOST_MPI_Comm comm, const char * name)
SolverDestroyDataPetsc
(
data
);
*
data
=
static_cast
<
void
*>
(
new
KSP
);
#if !defined(USE_MPI)
ierr
=
KSPCreate
(
PETSC_COMM_WORLD
,
static_cast
<
KSP
*>
(
*
data
))
;
ierr
=
KSPCreate
(
PETSC_COMM_WORLD
,
static_cast
<
KSP
*>
(
*
data
));
(
void
)
comm
;
#else
ierr
=
KSPCreate
(
comm
,
static_cast
<
KSP
*>
(
*
data
));
#endif
...
...
@@ -237,7 +237,7 @@ void SolverCopyDataPetsc(void ** data, void * other_data, INMOST_MPI_Comm comm)
SolverDestroyDataPetsc
(
data
);
*
data
=
static_cast
<
void
*>
(
new
KSP
);
#if !defined(USE_MPI)
ierr
=
KSPCreate
(
PETSC_COMM_WORLD
,
static_cast
<
KSP
*>
(
*
data
))
;
ierr
=
KSPCreate
(
PETSC_COMM_WORLD
,
static_cast
<
KSP
*>
(
*
data
));
(
void
)
comm
;
#else
ierr
=
KSPCreate
(
comm
,
static_cast
<
KSP
*>
(
*
data
));
#endif
...
...
@@ -277,7 +277,7 @@ void SolverSetMatrixPetsc(void * data, void * matrix_data, bool same_pattern, bo
ierr
=
KSPSetReusePreconditioner
(
*
m
,
PETSC_TRUE
);
else
ierr
=
KSPSetReusePreconditioner
(
*
m
,
PETSC_FALSE
);
ierr
=
KSPSetOperators
(
*
m
,
*
mat
,
*
mat
);
//,reuse_preconditioner? SAME_PRECONDITIONER : (same_pattern? SAME_NONZERO_PATTERN : DIFFERENT_NONZERO_PATTERN));
ierr
=
KSPSetOperators
(
*
m
,
*
mat
,
*
mat
);
(
void
)
same_pattern
;
//,reuse_preconditioner? SAME_PRECONDITIONER : (same_pattern? SAME_NONZERO_PATTERN : DIFFERENT_NONZERO_PATTERN));
if
(
ierr
!=
PETSC_SUCCESS
)
throw
INMOST
::
ErrorInSolver
;
}
...
...
Source/Solver/sparse.cpp
View file @
359312ab
...
...
@@ -1021,10 +1021,10 @@ namespace INMOST
void
LockService
::
GetInterval
(
INMOST_DATA_ENUM_TYPE
&
start
,
INMOST_DATA_ENUM_TYPE
&
end
)
const
{
start
=
locks
.
get_interval_beg
();
end
=
locks
.
get_interval_end
();}
#else
bool
LockService
::
HaveLocks
()
const
{
return
false
;}
bool
LockService
::
Lock
(
INMOST_DATA_ENUM_TYPE
row
)
{
return
true
;}
bool
LockService
::
TestLock
(
INMOST_DATA_ENUM_TYPE
row
)
{
return
true
;}
bool
LockService
::
UnLock
(
INMOST_DATA_ENUM_TYPE
row
)
{
return
true
;}
void
LockService
::
SetInterval
(
INMOST_DATA_ENUM_TYPE
beg
,
INMOST_DATA_ENUM_TYPE
end
)
{
}
bool
LockService
::
Lock
(
INMOST_DATA_ENUM_TYPE
row
)
{(
void
)
row
;
return
true
;}
bool
LockService
::
TestLock
(
INMOST_DATA_ENUM_TYPE
row
)
{(
void
)
row
;
return
true
;}
bool
LockService
::
UnLock
(
INMOST_DATA_ENUM_TYPE
row
)
{(
void
)
row
;
return
true
;}
void
LockService
::
SetInterval
(
INMOST_DATA_ENUM_TYPE
beg
,
INMOST_DATA_ENUM_TYPE
end
)
{(
void
)
beg
;
(
void
)
end
;
}
void
LockService
::
DestroyLocks
()
{}
INMOST_DATA_ENUM_TYPE
LockService
::
GetFirstIndex
()
const
{
return
0
;}
INMOST_DATA_ENUM_TYPE
LockService
::
GetLastIndex
()
const
{
return
0
;}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment