Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Kirill Terekhov
INMOST
Commits
9a92cf91
Commit
9a92cf91
authored
Jun 26, 2015
by
Igor Konshin
Browse files
Merge branch 'master' of
https://github.com/INMOST-DEV/INMOST
Conflicts: solver.cpp
parents
b2d17c6f
8cfc4bfa
Changes
27
Expand all
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
9a92cf91
...
...
@@ -101,6 +101,7 @@ option(COMPILE_TESTS "Compile some tests" OFF)
option
(
USE_PARTITIONER_PARMETIS
"Use ParMetis partitioner"
OFF
)
option
(
USE_PARTITIONER_ZOLTAN
"Use Zoltan partitioner"
OFF
)
option
(
USE_SOLVER_METIS
"Use METIS for matrix reordering"
OFF
)
option
(
USE_SOLVER_MONDRIAAN
"Use Mondriaan for matrix reordering"
OFF
)
option
(
USE_SOLVER_PETSC
"Use PETSc solvers"
OFF
)
option
(
USE_SOLVER_TRILINOS
"Use Trilinos solvers"
OFF
)
#option(USE_AUTODIFF_OPENCL "Use OpenCL for automatic differentiation (under work)" OFF)
...
...
@@ -174,6 +175,20 @@ if(USE_SOLVER_METIS)
endif
()
endif
()
if
(
USE_SOLVER_MONDRIAAN
)
find_package
(
MONDRIAAN
)
if
(
NOT MONDRIAAN_FOUND
)
set
(
USE_SOLVER_MONDRIAAN OFF
)
message
(
"Mondriaan NOT FOUND"
)
else
()
link_directories
(
${
MONDRIAAN_LIBRARY_DIRS
}
)
include_directories
(
${
MONDRIAAN_INCLUDE_DIRS
}
)
set
(
USE_SOLVER_MONDRIAAN ON
)
message
(
"Mondriaan FOUND"
)
endif
()
endif
()
if
(
USE_PARTITIONER_ZOLTAN
)
find_package
(
ZOLTAN
)
if
(
NOT ZOLTAN_FOUND
)
...
...
Debuggers/VisualStudio/readme.txt
View file @
9a92cf91
...
...
@@ -2,6 +2,6 @@ Copy and paste contents of autoexp.dat into
C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\Packages\Debugger\autoexp.dat
or the directry where Visual Studio was installed.
In future capabilities will gro
ve
.
In future capabilities will gro
w
.
Tested with Visual studio 2010.
cmake_find/LICENSE
0 → 100644
View file @
9a92cf91
Copyright (c) 2014-2015
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
cmake_find/readme.txt
0 → 100644
View file @
9a92cf91
This folder contains scripts for CMake that aid in compilation of the INMOST library with third party libraries.
The original files were obtained through internet from the following projects:
- PETSc
- MSTK
- FindOpenCL
And may appear in original or modified form.
\ No newline at end of file
examples/DrawMatrix/CMakeLists.txt
View file @
9a92cf91
...
...
@@ -34,6 +34,10 @@ if(OPENGL_FOUND)
message
(
"linking DrawMatrix with Metis"
)
target_link_libraries
(
DrawMatrix
${
METIS_LIBRARIES
}
)
endif
()
if
(
USE_SOLVER_MONDRIAAN
)
message
(
"linking DrawMatrix with Mondriaan"
)
target_link_libraries
(
DrawMatrix
${
MONDRIAAN_LIBRARIES
}
)
endif
()
endif
()
...
...
examples/FVDiscr/CMakeLists.txt
View file @
9a92cf91
...
...
@@ -25,6 +25,10 @@ if(USE_SOLVER)
message
(
"linking FVDiscr with Metis"
)
target_link_libraries
(
FVDiscr
${
METIS_LIBRARIES
}
)
endif
()
if
(
USE_SOLVER_MONDRIAAN
)
message
(
"linking FVDiscr with Mondriaan"
)
target_link_libraries
(
FVDiscr
${
MONDRIAAN_LIBRARIES
}
)
endif
()
endif
()
...
...
examples/FVDiscr/main.cpp
View file @
9a92cf91
...
...
@@ -128,6 +128,7 @@ int main(int argc,char ** argv)
ttt
=
Timer
();
Solver
S
(
Solver
::
INNER_ILU2
);
// Specify the linear solver to ASM+ILU2+BiCGStab one
S
.
SetParameterReal
(
"absolute_tolerance"
,
1e-8
);
Solver
::
Matrix
A
;
// Declare the matrix of the linear system to be solved
Solver
::
Vector
x
,
b
;
// Declare the solution and the right-hand side vectors
...
...
@@ -242,6 +243,8 @@ int main(int argc,char ** argv)
ttt
=
Timer
();
Tag
error
=
m
->
CreateTag
(
"error"
,
DATA_REAL
,
CELL
,
NONE
,
1
);
Storage
::
real
err_C
=
0.0
,
err_L2
=
0.0
;
for
(
Mesh
::
iteratorCell
cell
=
m
->
BeginCell
();
cell
!=
m
->
EndCell
();
++
cell
)
if
(
cell
->
GetStatus
()
!=
Element
::
Ghost
)
...
...
@@ -251,6 +254,7 @@ int main(int argc,char ** argv)
if
(
err
>
err_C
)
err_C
=
err
;
err_L2
+=
err
*
err
*
cell
->
Volume
();
cell
->
Real
(
error
)
=
err
;
// x[cell->Integer(id)] = err;
}
err_C
=
m
->
AggregateMax
(
err_C
);
// Compute the maximal C norm for the error
...
...
examples/MatSolve/CMakeLists.txt
View file @
9a92cf91
...
...
@@ -33,6 +33,10 @@ if(USE_SOLVER)
message
(
"linking MatSolve with Metis"
)
target_link_libraries
(
MatSolve
${
METIS_LIBRARIES
}
)
endif
()
if
(
USE_SOLVER_MONDRIAAN
)
message
(
"linking MatSolve with Mondriaan"
)
target_link_libraries
(
MatSolve
${
MONDRIAAN_LIBRARIES
}
)
endif
()
endif
()
...
...
examples/OctreeCutcell/octgrid.cpp
View file @
9a92cf91
...
...
@@ -538,6 +538,7 @@ class incident_matrix
}
return
success
;
}
/*
Storage::real compute_measure(dynarray<T,64> & data)
{
Storage::real measure = 0;
...
...
@@ -622,6 +623,7 @@ class incident_matrix
}
return measure;
}
*/
void
recursive_find
(
unsigned
node
,
unsigned
length
)
{
if
(
!
min_loop
.
empty
()
&&
length
>
min_loop
.
size
()
)
return
;
...
...
@@ -851,7 +853,7 @@ public:
}
}
while
(
min_loop
.
empty
()
&&
first
!=
UINT_MAX
);
for
(
dynarray
<
T
,
64
>::
iterator
it
=
min_loop
.
begin
();
it
!=
min_loop
.
end
();
++
it
)
for
(
typename
dynarray
<
T
,
64
>::
iterator
it
=
min_loop
.
begin
();
it
!=
min_loop
.
end
();
++
it
)
ret
.
push_back
(
it
->
self
());
//ret.insert(ret.end(),min_loop.begin(),min_loop.end());
min_loop
.
clear
();
...
...
examples/OldDrawGrid/main.cpp
View file @
9a92cf91
This diff is collapsed.
Click to expand it.
examples/OldDrawGrid/rotate.cpp
View file @
9a92cf91
...
...
@@ -168,6 +168,46 @@ void rotatevector(double * vec)
vec
[
2
]
=
ret
[
2
]
/
ret
[
3
];
}
void
reverse_rotatevector
(
double
*
vec
)
{
int
i
;
double
rot
[
16
];
double
temp
[
4
]
=
{
vec
[
0
],
vec
[
1
],
vec
[
2
],
1.0
};
double
ret
[
4
];
q
.
x
=
-
q
.
x
;
q
.
y
=
-
q
.
y
;
q
.
z
=
-
q
.
z
;
rot
[
0
]
=
(
q
.
w
*
q
.
w
+
q
.
x
*
q
.
x
-
q
.
y
*
q
.
y
-
q
.
z
*
q
.
z
);
rot
[
1
]
=
2.
*
(
q
.
x
*
q
.
y
-
q
.
w
*
q
.
z
);
rot
[
2
]
=
2.
*
(
q
.
x
*
q
.
z
+
q
.
w
*
q
.
y
);
rot
[
3
]
=
0.0
;
rot
[
4
]
=
2.
*
(
q
.
x
*
q
.
y
+
q
.
w
*
q
.
z
);
rot
[
5
]
=
(
q
.
w
*
q
.
w
-
q
.
x
*
q
.
x
+
q
.
y
*
q
.
y
-
q
.
z
*
q
.
z
);
rot
[
6
]
=
2.
*
(
q
.
y
*
q
.
z
-
q
.
w
*
q
.
x
);
rot
[
7
]
=
0.0
;
rot
[
8
]
=
2.
*
(
q
.
x
*
q
.
z
-
q
.
w
*
q
.
y
);
rot
[
9
]
=
2.
*
(
q
.
y
*
q
.
z
+
q
.
w
*
q
.
x
);
rot
[
10
]
=
(
q
.
w
*
q
.
w
-
q
.
x
*
q
.
x
-
q
.
y
*
q
.
y
+
q
.
z
*
q
.
z
);
rot
[
11
]
=
0.0
;
rot
[
12
]
=
0.0
;
rot
[
13
]
=
0.0
;
rot
[
14
]
=
0.0
;
rot
[
15
]
=
(
q
.
w
*
q
.
w
+
q
.
x
*
q
.
x
+
q
.
y
*
q
.
y
+
q
.
z
*
q
.
z
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ret
[
i
]
=
temp
[
0
]
*
rot
[
i
*
4
];
ret
[
i
]
+=
temp
[
1
]
*
rot
[
i
*
4
+
1
];
ret
[
i
]
+=
temp
[
2
]
*
rot
[
i
*
4
+
2
];
ret
[
i
]
+=
temp
[
3
]
*
rot
[
i
*
4
+
3
];
}
vec
[
0
]
=
ret
[
0
]
/
ret
[
3
];
vec
[
1
]
=
ret
[
1
]
/
ret
[
3
];
vec
[
2
]
=
ret
[
2
]
/
ret
[
3
];
q
.
x
=
-
q
.
x
;
q
.
y
=
-
q
.
y
;
q
.
z
=
-
q
.
z
;
}
void
revrotatevector
(
double
*
vec
)
{
int
i
;
...
...
@@ -240,6 +280,51 @@ void rotatevector_from_stack(double * vec)
vec
[
2
]
=
ret
[
2
]
/
ret
[
3
];
}
void
quatget
(
double
*
vec
)
{
vec
[
0
]
=
q
.
x
/
q
.
w
;
vec
[
1
]
=
q
.
y
/
q
.
w
;
vec
[
2
]
=
q
.
z
/
q
.
w
;
}
void
reverse_rotatevector_from_stack
(
double
*
vec
)
{
int
i
;
struct
quaternion
q
=
storage
.
back
();
q
.
x
=
-
q
.
x
;
q
.
y
=
-
q
.
y
;
q
.
z
=
-
q
.
z
;
double
rot
[
16
];
double
temp
[
4
]
=
{
vec
[
0
],
vec
[
1
],
vec
[
2
],
1.0
};
double
ret
[
4
];
rot
[
0
]
=
(
q
.
w
*
q
.
w
+
q
.
x
*
q
.
x
-
q
.
y
*
q
.
y
-
q
.
z
*
q
.
z
);
rot
[
1
]
=
2.
*
(
q
.
x
*
q
.
y
-
q
.
w
*
q
.
z
);
rot
[
2
]
=
2.
*
(
q
.
x
*
q
.
z
+
q
.
w
*
q
.
y
);
rot
[
3
]
=
0.0
;
rot
[
4
]
=
2.
*
(
q
.
x
*
q
.
y
+
q
.
w
*
q
.
z
);
rot
[
5
]
=
(
q
.
w
*
q
.
w
-
q
.
x
*
q
.
x
+
q
.
y
*
q
.
y
-
q
.
z
*
q
.
z
);
rot
[
6
]
=
2.
*
(
q
.
y
*
q
.
z
-
q
.
w
*
q
.
x
);
rot
[
7
]
=
0.0
;
rot
[
8
]
=
2.
*
(
q
.
x
*
q
.
z
-
q
.
w
*
q
.
y
);
rot
[
9
]
=
2.
*
(
q
.
y
*
q
.
z
+
q
.
w
*
q
.
x
);
rot
[
10
]
=
(
q
.
w
*
q
.
w
-
q
.
x
*
q
.
x
-
q
.
y
*
q
.
y
+
q
.
z
*
q
.
z
);
rot
[
11
]
=
0.0
;
rot
[
12
]
=
0.0
;
rot
[
13
]
=
0.0
;
rot
[
14
]
=
0.0
;
rot
[
15
]
=
(
q
.
w
*
q
.
w
+
q
.
x
*
q
.
x
+
q
.
y
*
q
.
y
+
q
.
z
*
q
.
z
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
ret
[
i
]
=
temp
[
0
]
*
rot
[
i
*
4
];
ret
[
i
]
+=
temp
[
1
]
*
rot
[
i
*
4
+
1
];
ret
[
i
]
+=
temp
[
2
]
*
rot
[
i
*
4
+
2
];
ret
[
i
]
+=
temp
[
3
]
*
rot
[
i
*
4
+
3
];
}
vec
[
0
]
=
ret
[
0
]
/
ret
[
3
];
vec
[
1
]
=
ret
[
1
]
/
ret
[
3
];
vec
[
2
]
=
ret
[
2
]
/
ret
[
3
];
}
void
rotate
()
{
double
rot
[
16
];
...
...
examples/OldDrawGrid/rotate.h
View file @
9a92cf91
...
...
@@ -20,13 +20,16 @@
void
clickmotion
(
int
nmx
,
int
nmy
);
void
motion
(
int
nmx
,
int
nmy
);
void
click
(
int
b
,
int
s
,
int
nmx
,
int
nmy
);
void
quatget
(
double
*
vec
);
void
quatinit
();
void
quatpush
();
void
quatpop
();
void
rotate
();
void
rotate_from_stack
();
void
rotatevector
(
double
*
vec
);
void
reverse_rotatevector
(
double
*
vec
);
void
revrotatevector
(
double
*
vec
);
void
rotatevector_from_stack
(
double
*
vec
);
void
reverse_rotatevector_from_stack
(
double
*
vec
);
#endif
examples/Solver/CMakeLists.txt
View file @
9a92cf91
...
...
@@ -25,6 +25,10 @@ if(USE_SOLVER)
message
(
"linking Solver with Metis"
)
target_link_libraries
(
Solver
${
METIS_LIBRARIES
}
)
endif
()
if
(
USE_SOLVER_MONDRIAAN
)
message
(
"linking Solver with Mondriaan"
)
target_link_libraries
(
Solver
${
MONDRIAAN_LIBRARIES
}
)
endif
()
endif
(
USE_SOLVER
)
if
(
USE_PARTITIONER
)
...
...
geometry.cpp
View file @
9a92cf91
...
...
@@ -529,6 +529,9 @@ namespace INMOST
void
Mesh
::
GetGeometricData
(
HandleType
e
,
GeometricData
type
,
Storage
::
real
*
ret
)
{
assert
(
e
!=
InvalidHandle
());
assert
(
ret
!=
NULL
);
assert
(
type
==
MEASURE
||
type
==
CENTROID
||
type
==
BARYCENTER
||
type
==
NORMAL
);
ElementType
etype
=
GetHandleElementType
(
e
);
integer
edim
=
Element
::
GetGeometricDimension
(
GetGeometricType
(
e
));
integer
mdim
=
GetDimensions
();
...
...
inmost-config.cmake.in
View file @
9a92cf91
...
...
@@ -27,6 +27,8 @@ set(INMOST_LIBRARIES inmost)
set(USE_MPI @USE_MPI@)
set(USE_PARTITIONER_ZOLTAN @USE_PARTITIONER_ZOLTAN@)
set(USE_PARTITIONER_PARMETIS @USE_PARTITIONER_PARMETIS@)
set(USE_SOLVER_MONDRIAAN @USE_SOLVER_MONDRIAAN@)
set(USE_SOLVER_METIS @USE_SOLVER_METIS@)
set(USE_SOLVER_TRILINOS @USE_SOLVER_TRILINOS@)
set(USE_SOLVER_PETSC @USE_SOLVER_PETSC@)
...
...
@@ -49,6 +51,16 @@ if( USE_PARTITIONER_PARMETIS )
list(APPEND INMOST_INCLUDE_DIRS "@METIS_INCLUDE_DIR@")
endif( USE_PARTITIONER_PARMETIS )
if( USE_SOLVER_MONDRIAAN )
list(APPEND INMOST_LIBRARIES "@MONDRIAAN_LIBRARIES@")
list(APPEND INMOST_INCLUDE_DIRS "@MONDRIAAN_INCLUDE_DIRS@")
list(APPEND INMOST_LIBRARY_DIRS "@MONDRIAAN_LIBRARY_DIRS@")
endif( USE_SOLVER_MONDRIAAN )
if( USE_SOLVER_METIS )
list(APPEND INMOST_LIBRARIES "@METIS_LIBRARIES@")
list(APPEND INMOST_INCLUDE_DIRS "@METIS_INCLUDE_DIR@")
endif( USE_SOLVER_METIS )
if( USE_SOLVER_TRILINOS )
list(APPEND INMOST_LIBRARIES "@Trilinos_LIBRARIES@")
...
...
inmost_mesh.h
View file @
9a92cf91
...
...
@@ -137,7 +137,7 @@ namespace INMOST
__INLINE
INMOST_DATA_INTEGER_TYPE
GetHandleElementNum
(
HandleType
h
)
{
return
h
>>
handle_etype_shift
;}
__INLINE
ElementType
GetHandleElementType
(
HandleType
h
)
{
return
1
<<
GetHandleElementNum
(
h
);}
__INLINE
HandleType
ComposeHandle
(
ElementType
etype
,
INMOST_DATA_INTEGER_TYPE
ID
)
{
return
ID
==
-
1
?
InvalidHandle
()
:
((
ElementNum
(
etype
)
<<
handle_etype_shift
)
+
(
1
+
ID
));}
__INLINE
HandleType
ComposeHandle
(
INMOST_DATA_INTEGER_TYPE
etypenum
,
INMOST_DATA_INTEGER_TYPE
ID
)
{
return
ID
==
-
1
?
InvalidHandle
()
:
((
etypenum
<<
handle_etype_shift
)
+
(
1
+
ID
));}
__INLINE
HandleType
ComposeHandle
Num
(
INMOST_DATA_INTEGER_TYPE
etypenum
,
INMOST_DATA_INTEGER_TYPE
ID
)
{
return
ID
==
-
1
?
InvalidHandle
()
:
((
etypenum
<<
handle_etype_shift
)
+
(
1
+
ID
));}
__INLINE
bool
isValidHandle
(
HandleType
h
)
{
return
h
!=
0
;}
...
...
@@ -2356,7 +2356,7 @@ namespace INMOST
void
Exit
();
int
&
GetFuncID
()
{
return
func_id
;}
std
::
fstream
&
GetStream
();
std
::
f
stream
&
WriteTab
(
std
::
f
stream
&
f
);
std
::
o
stream
&
WriteTab
(
std
::
o
stream
&
f
);
void
FinalizeFile
();
static
void
AtExit
(
void
);
#endif
...
...
@@ -2933,7 +2933,7 @@ namespace INMOST
void
EndSequentialCode
();
//iterator.cpp::::::::::::::::::::::::::::::::::::::::::::::::::
public:
Element
ElementByLocalID
(
integer
etypenum
,
integer
lid
)
{
assert
(
etypenum
<
5
&&
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
etypenum
].
size
()))
||
(
etypenum
==
5
&&
lid
==
0
));
return
Element
(
this
,
ComposeHandle
(
etypenum
,
lid
));}
Element
ElementByLocalID
(
integer
etypenum
,
integer
lid
)
{
assert
(
etypenum
<
5
&&
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
etypenum
].
size
()))
||
(
etypenum
==
5
&&
lid
==
0
));
return
Element
(
this
,
ComposeHandle
Num
(
etypenum
,
lid
));}
Element
ElementByLocalID
(
ElementType
etype
,
integer
lid
)
{
return
ElementByLocalID
(
ElementNum
(
etype
),
lid
);}
Element
ElementByHandle
(
HandleType
h
)
{
return
Element
(
this
,
h
);}
...
...
@@ -2941,16 +2941,16 @@ namespace INMOST
HandleType
PrevHandle
(
HandleType
h
)
const
;
//returns InvalidHandle() when go beyond first element
HandleType
NextHandle
(
HandleType
h
,
ElementType
mask
)
const
;
HandleType
PrevHandle
(
HandleType
h
,
ElementType
mask
)
const
;
//returns InvalidHandle() when go beyond first element
HandleType
FirstHandle
()
const
{
return
ComposeHandle
(
ElementNum
(
NODE
),
0
);}
HandleType
LastHandle
()
const
{
return
ComposeHandle
(
ElementNum
(
MESH
),
1
);}
HandleType
FirstHandle
(
ElementType
etype
)
const
{
return
ComposeHandle
(
ElementNum
(
etype
),
0
);}
HandleType
LastHandle
(
ElementType
etype
)
const
{
integer
num
=
ElementNum
(
etype
);
return
ComposeHandle
(
num
,
static_cast
<
integer
>
(
links
[
num
].
size
()));}
HandleType
FirstHandle
()
const
{
return
ComposeHandle
Num
(
ElementNum
(
NODE
),
0
);}
HandleType
LastHandle
()
const
{
return
ComposeHandle
Num
(
ElementNum
(
MESH
),
1
);}
HandleType
FirstHandle
(
ElementType
etype
)
const
{
return
ComposeHandle
Num
(
ElementNum
(
etype
),
0
);}
HandleType
LastHandle
(
ElementType
etype
)
const
{
integer
num
=
ElementNum
(
etype
);
return
ComposeHandle
Num
(
num
,
static_cast
<
integer
>
(
links
[
num
].
size
()));}
Node
NodeByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
0
].
size
()));
return
Node
(
this
,
ComposeHandle
(
0
,
lid
));
}
Edge
EdgeByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
1
].
size
()));
return
Edge
(
this
,
ComposeHandle
(
1
,
lid
));
}
Face
FaceByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
2
].
size
()));
return
Face
(
this
,
ComposeHandle
(
2
,
lid
));}
Cell
CellByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
3
].
size
()));
return
Cell
(
this
,
ComposeHandle
(
3
,
lid
));
}
ElementSet
EsetByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
4
].
size
()));
return
ElementSet
(
this
,
ComposeHandle
(
4
,
lid
));
}
Node
NodeByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
0
].
size
()));
return
Node
(
this
,
ComposeHandle
Num
(
0
,
lid
));
}
Edge
EdgeByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
1
].
size
()));
return
Edge
(
this
,
ComposeHandle
Num
(
1
,
lid
));
}
Face
FaceByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
2
].
size
()));
return
Face
(
this
,
ComposeHandle
Num
(
2
,
lid
));}
Cell
CellByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
3
].
size
()));
return
Cell
(
this
,
ComposeHandle
Num
(
3
,
lid
));
}
ElementSet
EsetByLocalID
(
integer
lid
)
{
assert
(
lid
>=
0
&&
lid
<
static_cast
<
integer
>
(
links
[
4
].
size
()));
return
ElementSet
(
this
,
ComposeHandle
Num
(
4
,
lid
));
}
integer
NodeNextLocalID
(
integer
lid
)
const
{
++
lid
;
while
(
lid
<
static_cast
<
integer
>
(
links
[
0
].
size
())
&&
links
[
0
][
lid
]
==
-
1
)
++
lid
;
return
lid
;}
integer
EdgeNextLocalID
(
integer
lid
)
const
{
++
lid
;
while
(
lid
<
static_cast
<
integer
>
(
links
[
1
].
size
())
&&
links
[
1
][
lid
]
==
-
1
)
++
lid
;
return
lid
;}
...
...
inmost_options_cmake.h
View file @
9a92cf91
...
...
@@ -15,6 +15,7 @@
#cmakedefine USE_PARTITIONER_PARMETIS
#cmakedefine USE_SOLVER
#cmakedefine USE_SOLVER_MONDRIAAN
#cmakedefine USE_SOLVER_METIS
#cmakedefine USE_SOLVER_PETSC
#cmakedefine USE_SOLVER_TRILINOS
...
...
iterator.cpp
View file @
9a92cf91
...
...
@@ -50,7 +50,7 @@ namespace INMOST
else
break
;
}
if
(
num
==
5
&&
id
>
0
)
id
=
1
;
return
ComposeHandle
(
num
,
id
);
return
ComposeHandle
Num
(
num
,
id
);
}
HandleType
Mesh
::
PrevHandle
(
HandleType
h
)
const
...
...
@@ -61,7 +61,7 @@ namespace INMOST
{
if
(
id
<
0
)
num
=
4
;
else
return
ComposeHandle
(
ElementNum
(
MESH
),
0
);
else
return
ComposeHandle
Num
(
ElementNum
(
MESH
),
0
);
}
while
(
num
>=
0
)
{
...
...
@@ -74,7 +74,7 @@ namespace INMOST
else
break
;
}
if
(
num
<
0
)
return
InvalidHandle
();
return
ComposeHandle
(
num
,
id
);
return
ComposeHandle
Num
(
num
,
id
);
}
HandleType
Mesh
::
NextHandle
(
HandleType
h
,
ElementType
etype
)
const
...
...
@@ -102,7 +102,7 @@ namespace INMOST
else
break
;
}
if
(
num
==
5
&&
id
>
0
)
id
=
1
;
return
ComposeHandle
(
num
,
id
);
return
ComposeHandle
Num
(
num
,
id
);
}
HandleType
Mesh
::
PrevHandle
(
HandleType
h
,
ElementType
etype
)
const
...
...
@@ -127,7 +127,7 @@ namespace INMOST
}
if
(
stop
)
return
InvalidHandle
();
}
else
return
ComposeHandle
(
ElementNum
(
MESH
),
0
);
else
return
ComposeHandle
Num
(
ElementNum
(
MESH
),
0
);
}
while
(
num
>=
0
)
{
...
...
@@ -150,7 +150,7 @@ namespace INMOST
else
break
;
}
if
(
num
<
0
)
return
InvalidHandle
();
return
ComposeHandle
(
num
,
id
);
return
ComposeHandle
Num
(
num
,
id
);
}
Storage
::
integer
Mesh
::
FirstLocalID
(
ElementType
etype
)
const
...
...
mesh.cpp
View file @
9a92cf91
...
...
@@ -440,7 +440,7 @@ namespace INMOST
#endif //USE_MPI
#if defined(USE_PARALLEL_WRITE_TIME)
FinalizeFile
();
out_time
.
close
();
for
(
size_t
q
=
0
;
q
<
allocated_meshes
.
size
();
++
q
)
if
(
allocated_meshes
[
q
]
==
this
)
allocated_meshes
[
q
]
=
NULL
;
...
...
@@ -862,7 +862,7 @@ namespace INMOST
Node
Mesh
::
CreateNode
(
const
real
*
coords
)
{
integer
id
=
TieElement
(
0
);
HandleType
h
=
ComposeHandle
(
0
,
id
);
HandleType
h
=
ComposeHandle
Num
(
0
,
id
);
SetGeometricType
(
h
,
Element
::
Vertex
);
real
*
v
=
static_cast
<
Storage
::
real
*>
(
MGetDenseLink
(
h
,
CoordsTag
()));
for
(
integer
i
=
0
;
i
<
dim
;
i
++
)
v
[
i
]
=
coords
[
i
];
...
...
@@ -912,7 +912,7 @@ namespace INMOST
if
(
test
!=
InvalidHandle
())
return
std
::
make_pair
(
Edge
(
this
,
test
),
false
);
}
integer
id
=
TieElement
(
1
);
he
=
ComposeHandle
(
1
,
id
);
he
=
ComposeHandle
Num
(
1
,
id
);
for
(
ElementArray
<
Node
>::
size_type
i
=
0
;
i
<
nodes
.
size
();
i
++
)
{
Element
::
adj_type
&
hc
=
HighConn
(
nodes
.
at
(
i
));
...
...
@@ -1004,7 +1004,7 @@ namespace INMOST
if
(
test
!=
InvalidHandle
())
return
std
::
make_pair
(
Face
(
this
,
test
),
false
);
}
integer
id
=
TieElement
(
2
);
he
=
ComposeHandle
(
2
,
id
);
he
=
ComposeHandle
Num
(
2
,
id
);
for
(
ElementArray
<
Edge
>::
size_type
i
=
0
;
i
<
f_edges
.
size
();
i
++
)
{
Element
::
adj_type
&
hc
=
HighConn
(
f_edges
.
at
(
i
));
...
...
@@ -1374,7 +1374,7 @@ namespace INMOST
if
(
test
!=
InvalidHandle
())
return
std
::
make_pair
(
Cell
(
this
,
test
),
false
);
}
integer
id
=
TieElement
(
3
);
he
=
ComposeHandle
(
3
,
id
);
he
=
ComposeHandle
Num
(
3
,
id
);
for
(
ElementArray
<
Face
>::
size_type
i
=
0
;
i
<
c_faces
.
size
();
i
++
)
{
Element
::
adj_type
&
hc
=
HighConn
(
c_faces
.
at
(
i
));
...
...
@@ -1476,7 +1476,7 @@ namespace INMOST
if
(
e
->
GetName
()
==
name
)
return
std
::
make_pair
(
e
->
self
(),
false
);
}
HandleType
he
=
ComposeHandle
(
4
,
TieElement
(
4
));
HandleType
he
=
ComposeHandle
Num
(
4
,
TieElement
(
4
));
bulk_array
set_name
=
BulkArrayDV
(
he
,
SetNameTag
());
set_name
.
resize
(
static_cast
<
bulk_array
::
size_type
>
(
name
.
size
()));
memcpy
(
set_name
.
data
(),
name
.
c_str
(),
name
.
size
());
...
...
@@ -1498,7 +1498,7 @@ namespace INMOST
Storage
::
integer
j
=
0
;
for
(
Storage
::
integer
k
=
0
;
k
<
NodeLastLocalID
();
++
k
)
if
(
isValidElement
(
0
,
k
)
)
{
memcpy
(
temp
.
data
()
+
j
,
MGetDenseLink
(
ComposeHandle
(
0
,
k
),
CoordsTag
()),
sizeof
(
Storage
::
real
)
*
dims
);
memcpy
(
temp
.
data
()
+
j
,
MGetDenseLink
(
ComposeHandle
Num
(
0
,
k
),
CoordsTag
()),
sizeof
(
Storage
::
real
)
*
dims
);
j
+=
dims
;
}
...
...
@@ -1507,7 +1507,7 @@ namespace INMOST
j
=
0
;
for
(
Storage
::
integer
k
=
0
;
k
<
NodeLastLocalID
();
++
k
)
if
(
isValidElement
(
0
,
k
)
)
{
memcpy
(
MGetDenseLink
(
ComposeHandle
(
0
,
k
),
CoordsTag
()),
temp
.
data
()
+
j
,
sizeof
(
Storage
::
real
)
*
dims
);
memcpy
(
MGetDenseLink
(
ComposeHandle
Num
(
0
,
k
),
CoordsTag
()),
temp
.
data
()
+
j
,
sizeof
(
Storage
::
real
)
*
dims
);
j
+=
dims
;
}
dim
=
dims
;
...
...
@@ -1536,7 +1536,7 @@ namespace INMOST
back_links
[
etypenum
][
ADDR
]
=
-
1
;
empty_space
[
etypenum
].
push_back
(
ADDR
);
empty_links
[
etypenum
].
push_back
(
ID
);
//REPORT_VAL("destroyed",ComposeHandle(etypenum,ID) << " " << etypenum << " " << ADDR << " " << ID);
//REPORT_VAL("destroyed",ComposeHandle
Num
(etypenum,ID) << " " << etypenum << " " << ADDR << " " << ID);
}
}
...
...
@@ -1576,7 +1576,7 @@ namespace INMOST
new_size
=
GetArrayCapacity
(
etypenum
);
if
(
new_size
!=
old_size
)
ReallocateData
(
etypenum
,
new_size
);
back_links
[
etypenum
][
ADDR
]
=
ID
;
last_created
=
ComposeHandle
(
etypenum
,
ID
);
last_created
=
ComposeHandle
Num
(
etypenum
,
ID
);
//REPORT_VAL("created",last_created << " " << etypenum << " " << ADDR << " " << ID);
}
return
ID
;
...
...
mesh_file.cpp
View file @
9a92cf91
...
...
@@ -2946,6 +2946,7 @@ read_elem_num_link:
}
else
if
(
LFile
.
find
(
".pmf"
)
!=
std
::
string
::
npos
)
//this is inner parallel/platform mesh format
{
//std::cout << "parallel strategy " << parallel_strategy << " file strategy " << parallel_file_strategy << std::endl;
io_converter
<
INMOST_DATA_INTEGER_TYPE
,
INMOST_DATA_REAL_TYPE
>
iconv
;
io_converter
<
INMOST_DATA_ENUM_TYPE
,
INMOST_DATA_REAL_TYPE
>
uconv
;
REPORT_STR
(
"start load pmf"
);
...
...
@@ -2958,13 +2959,16 @@ read_elem_num_link:
#if defined(USE_MPI_FILE)
if
(
parallel_file_strategy
==
1
)
{
REPORT_STR
(
"strategy 1"
);
int
ierr
;
std
::
string
buffer
;
std
::
vector
<
char
>
buffer
;
MPI_File
fh
;
MPI_Status
stat
;
ierr
=
MPI_File_open
(
GetCommunicator
(),
const_cast
<
char
*>
(
File
.
c_str
()),
MPI_MODE_RDONLY
,
MPI_INFO_NULL
,
&
fh
);
if
(
ierr
!=
MPI_SUCCESS
)
MPI_Abort
(
GetCommunicator
(),
-
1
);
REPORT_MPI
(
ierr
=
MPI_File_open
(
GetCommunicator
(),
const_cast
<
char
*>
(
File
.
c_str
()),
MPI_MODE_RDONLY
,
MPI_INFO_NULL
,
&
fh
)
)
;
if
(
ierr
!=
MPI_SUCCESS
)
REPORT_MPI
(
MPI_Abort
(
GetCommunicator
(),
-
1
)
)
;
INMOST_DATA_ENUM_TYPE
numprocs
=
GetProcessorsNumber
(),
recvsize
=
0
,
mpirank
=
GetProcessorRank
();
REPORT_VAL
(
"number of processors"
,
numprocs
);
REPORT_VAL
(
"rank of processor"
,
mpirank
);
std
::
vector
<
INMOST_DATA_ENUM_TYPE
>
recvsizes
;
if
(
mpirank
==
0
)
//the alternative is to read alltogether
{
...
...
@@ -2973,32 +2977,44 @@ read_elem_num_link:
buffer
.
resize
(
3
);
//ierr = MPI_File_read_all(fh,&buffer[0],3,MPI_CHAR,&stat);
ierr
=
MPI_File_read_shared
(
fh
,
&
buffer
[
0
],
3
,
MPI_CHAR
,
&
stat
);
if
(
ierr
!=
MPI_SUCCESS
)
MPI_Abort
(
GetCommunicator
(),
-
1
);
REPORT_MPI
(
ierr
=
MPI_File_read_shared
(
fh
,
&
buffer
[
0
],
3
,
MPI_CHAR
,
&
stat
)
)
;
if
(
ierr
!=
MPI_SUCCESS
)
REPORT_MPI
(
MPI_Abort
(
GetCommunicator
(),
-
1
)
)
;
if
(
static_cast
<
HeaderType
>
(
buffer
[
0
])
!=
INMOST
::
INMOSTFile
)
throw
BadFile
;
header
<<
buffer
.
c_str
()
+
1
;
header
.
write
(
&
buffer
[
1
],
2
)
;
uconv
.
read_iByteOrder
(
header
);
uconv
.
read_iByteSize
(
header
);
REPORT_VAL
(
"integer_byte_order"
,
uconv
.
str_iByteOrder
(
uconv
.
get_iByteOrder
()));
REPORT_VAL
(
"integer_byte_size"
,(
int
)
uconv
.
get_iByteSize
());
buffer
.
resize
(
uconv
.
get_source_iByteSize
());
//ierr = MPI_File_read_all(fh,&buffer[0],buffer.size(),MPI_CHAR,&stat);
ierr
=
MPI_File_read_shared
(
fh
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
MPI_CHAR
,
&
stat
);
REPORT_MPI
(
ierr
=
MPI_File_read_shared
(
fh
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
MPI_CHAR
,
&
stat
)
)
;
if
(
ierr
!=
MPI_SUCCESS
)
MPI_Abort
(
GetCommunicator
(),
-
1
);
header
<<
buffer
;
header
.
write
(
&
buffer
[
0
],
buffer
.
size
())
;
uconv
.
read_iValue
(
header
,
datanum
);
REPORT_VAL
(
"number of data entries"
,
datanum
);
buffer
.
resize
(
datanum
*
uconv
.
get_source_iByteSize
());
std
::
vector
<
INMOST_DATA_ENUM_TYPE
>
datasizes
(
datanum
);
//ierr = MPI_File_read_all(fh,&buffer[0],buffer.size(),MPI_CHAR,&stat);
ierr
=
MPI_File_read_shared
(
fh
,
&
buffer
[
0
],
static_cast
<
INMOST_MPI_SIZE
>
(
buffer
.
size
()),
MPI_CHAR
,
&
stat
);
if
(
ierr
!=