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
fd3c0eee
Commit
fd3c0eee
authored
Dec 27, 2014
by
Kirill Terekhov
Browse files
Fixes
Various fixes
parent
f3de6b96
Changes
12
Hide whitespace changes
Inline
Side-by-side
TODO.txt
View file @
fd3c0eee
...
@@ -99,6 +99,15 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
...
@@ -99,6 +99,15 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
53) SortByGlobalID, globalid
53) SortByGlobalID, globalid
54) ( unit tests)
54) ( unit tests)
55) mpi_send/mpi_recv -
55) mpi_send/mpi_recv -
56) Enumerate with mask should accept MarkerType select to select elements
57) GlobalID service class with different operation options to help pick new global ids when mesh is modified locally
options:
a) global id continuous among processors
b) global id may have gaps but local interval for each processor is bounded
c) global id is just a unique number
58) vtk- "VTK_WRITE_SETS_TO_FILES" = "YES"
7.MSPP: () : , ,
7.MSPP: () : , ,
8.MSPP:
8.MSPP:
...
@@ -111,7 +120,7 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
...
@@ -111,7 +120,7 @@ mesh + !partitioner + !domain + solvers + +/-nonlinear solvers + autodiff + !sys
13. INMOST / MMTK = Mathematical Modelling ToolKit / NSTK
13. INMOST / MMTK = Mathematical Modelling ToolKit / NSTK
last_created_element -
()
last_created_element -
...
@@ -152,6 +161,14 @@ last_created_element -
...
@@ -152,6 +161,14 @@ last_created_element -
11) amls
11) amls
12)
12)
13) Matrix Row:
Row::MergeRows(linked_list_storage, row b
Matrix::MergeRow(alpha, row & a, real beta, row &b)
14) CSRMatrix, CSRRow
15) Matrix -> CSRMatrix
16) OrderInfo CSRMatrix
17)
solver:
solver:
read mc64
read mc64
...
...
eset.cpp
View file @
fd3c0eee
...
@@ -163,7 +163,7 @@ namespace INMOST
...
@@ -163,7 +163,7 @@ namespace INMOST
{
{
assert
(
GetElementType
()
==
ESET
);
assert
(
GetElementType
()
==
ESET
);
std
::
string
ret
;
std
::
string
ret
;
bulk_array
arr
=
BulkArrayD
F
(
GetMeshLink
()
->
SetNameTag
());
bulk_array
arr
=
BulkArrayD
V
(
GetMeshLink
()
->
SetNameTag
());
ret
.
resize
(
arr
.
size
());
ret
.
resize
(
arr
.
size
());
for
(
bulk_array
::
size_type
it
=
0
;
it
<
arr
.
size
();
++
it
)
for
(
bulk_array
::
size_type
it
=
0
;
it
<
arr
.
size
();
++
it
)
ret
[
it
]
=
arr
[
it
];
ret
[
it
]
=
arr
[
it
];
...
...
geometry.cpp
View file @
fd3c0eee
...
@@ -414,13 +414,16 @@ namespace INMOST
...
@@ -414,13 +414,16 @@ namespace INMOST
if
(
types
==
ORIENTATION
)
if
(
types
==
ORIENTATION
)
{
{
if
(
mask
&
FACE
)
if
(
mask
&
FACE
)
for
(
integer
e
=
0
;
e
<
FaceLastLocalID
();
++
e
)
if
(
isValidElement
(
FACE
,
e
)
)
for
(
integer
e
=
0
;
e
<
FaceLastLocalID
();
++
e
)
Face
(
this
,
e
)
->
FixNormalOrientation
();
{
if
(
isValidElement
(
FACE
,
e
)
)
Face
(
this
,
ComposeHandle
(
FACE
,
e
))
->
FixNormalOrientation
();
}
ShowGeometricData
(
ORIENTATION
,
FACE
);
ShowGeometricData
(
ORIENTATION
,
FACE
);
}
}
if
(
types
==
MEASURE
)
if
(
types
==
MEASURE
)
{
{
for
(
integer
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
etype
<<
1
)
for
(
ElementType
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
NextElementType
(
etype
)
)
{
{
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
MEASURE
,
etype
))
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
MEASURE
,
etype
))
{
{
...
@@ -436,7 +439,7 @@ namespace INMOST
...
@@ -436,7 +439,7 @@ namespace INMOST
}
}
if
(
types
==
CENTROID
)
if
(
types
==
CENTROID
)
{
{
for
(
ElementType
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
etype
<<
1
)
for
(
ElementType
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
NextElementType
(
etype
)
)
{
{
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
CENTROID
,
etype
))
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
CENTROID
,
etype
))
{
{
...
@@ -452,7 +455,7 @@ namespace INMOST
...
@@ -452,7 +455,7 @@ namespace INMOST
}
}
if
(
types
==
BARYCENTER
)
if
(
types
==
BARYCENTER
)
{
{
for
(
ElementType
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
etype
<<
1
)
for
(
ElementType
etype
=
EDGE
;
etype
<=
CELL
;
etype
=
NextElementType
(
etype
)
)
{
{
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
BARYCENTER
,
etype
))
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
BARYCENTER
,
etype
))
{
{
...
@@ -468,7 +471,7 @@ namespace INMOST
...
@@ -468,7 +471,7 @@ namespace INMOST
}
}
if
(
types
==
NORMAL
)
if
(
types
==
NORMAL
)
{
{
for
(
ElementType
etype
=
FACE
;
etype
<=
CELL
;
etype
=
etype
<<
1
)
for
(
ElementType
etype
=
FACE
;
etype
<=
CELL
;
etype
=
NextElementType
(
etype
)
)
{
{
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
NORMAL
,
etype
))
if
(
(
mask
&
etype
)
&&
!
HaveGeometricData
(
NORMAL
,
etype
))
{
{
...
@@ -693,15 +696,17 @@ namespace INMOST
...
@@ -693,15 +696,17 @@ namespace INMOST
else
else
{
{
ElementArray
<
Node
>
nodes
=
Element
(
this
,
e
)
->
getNodes
();
ElementArray
<
Node
>
nodes
=
Element
(
this
,
e
)
->
getNodes
();
Storage
::
real
div
=
1.0
/
nodes
.
size
();
memset
(
ret
,
0
,
sizeof
(
real
)
*
mdim
);
memset
(
ret
,
0
,
sizeof
(
real
)
*
mdim
);
assert
(
nodes
.
size
()
!=
0
);
if
(
nodes
.
size
()
!=
0
)
for
(
ElementArray
<
Node
>::
size_type
i
=
0
;
i
<
nodes
.
size
();
i
++
)
{
{
Storage
::
real_array
c
=
nodes
[
i
].
Coords
();
Storage
::
real
div
=
1.0
/
nodes
.
size
();
for
(
integer
j
=
0
;
j
<
mdim
;
j
++
)
ret
[
j
]
+=
c
[
j
];
for
(
ElementArray
<
Node
>::
size_type
i
=
0
;
i
<
nodes
.
size
();
i
++
)
{
Storage
::
real_array
c
=
nodes
[
i
].
Coords
();
for
(
integer
j
=
0
;
j
<
mdim
;
j
++
)
ret
[
j
]
+=
c
[
j
];
}
for
(
integer
j
=
0
;
j
<
mdim
;
j
++
)
ret
[
j
]
*=
div
;
}
}
for
(
integer
j
=
0
;
j
<
mdim
;
j
++
)
ret
[
j
]
*=
div
;
}
}
break
;
break
;
case
BARYCENTER
:
case
BARYCENTER
:
...
...
inmost_common.h
View file @
fd3c0eee
...
@@ -43,7 +43,7 @@
...
@@ -43,7 +43,7 @@
// output xml files for debugging of parallel algorithms
// output xml files for debugging of parallel algorithms
// search for style.xsl within examples for comfortable
// search for style.xsl within examples for comfortable
// view of generated xml files
// view of generated xml files
#define USE_PARALLEL_WRITE_TIME
//
#define USE_PARALLEL_WRITE_TIME
// this will revert Mesh::PrepareReceiveInner to always
// this will revert Mesh::PrepareReceiveInner to always
// use MPI point to point functionality disregarding problem type
// use MPI point to point functionality disregarding problem type
...
...
inmost_mesh.h
View file @
fd3c0eee
...
@@ -78,7 +78,6 @@ namespace INMOST
...
@@ -78,7 +78,6 @@ namespace INMOST
//Use topolgy checking for debug purposes
//Use topolgy checking for debug purposes
typedef
INMOST_DATA_ENUM_TYPE
TopologyCheck
;
typedef
INMOST_DATA_ENUM_TYPE
TopologyCheck
;
static
const
TopologyCheck
NO_ERROR
=
0x00000000
;
static
const
TopologyCheck
THROW_EXCEPTION
=
0x00000001
;
//done//throw TopologyError exception on error
static
const
TopologyCheck
THROW_EXCEPTION
=
0x00000001
;
//done//throw TopologyError exception on error
static
const
TopologyCheck
PRINT_NOTIFY
=
0x00000002
;
//done//print topology notify to std::cerr
static
const
TopologyCheck
PRINT_NOTIFY
=
0x00000002
;
//done//print topology notify to std::cerr
static
const
TopologyCheck
DELETE_ON_ERROR
=
0x00000004
;
//done//element should be deleted if there is an error in EndTopologyCheck
static
const
TopologyCheck
DELETE_ON_ERROR
=
0x00000004
;
//done//element should be deleted if there is an error in EndTopologyCheck
...
@@ -175,7 +174,7 @@ namespace INMOST
...
@@ -175,7 +174,7 @@ namespace INMOST
__INLINE
void
SetPosition
(
INMOST_DATA_ENUM_TYPE
pos
,
ElementType
type
)
{
mem
->
pos
[
ElementNum
(
type
)]
=
pos
;}
__INLINE
void
SetPosition
(
INMOST_DATA_ENUM_TYPE
pos
,
ElementType
type
)
{
mem
->
pos
[
ElementNum
(
type
)]
=
pos
;}
__INLINE
INMOST_DATA_ENUM_TYPE
GetPosition
(
ElementType
type
)
const
{
assert
(
mem
!=
NULL
);
return
mem
->
pos
[
ElementNum
(
type
)];}
__INLINE
INMOST_DATA_ENUM_TYPE
GetPosition
(
ElementType
type
)
const
{
assert
(
mem
!=
NULL
);
return
mem
->
pos
[
ElementNum
(
type
)];}
__INLINE
void
SetSparse
(
ElementType
type
)
{
mem
->
sparse
[
ElementNum
(
type
)]
=
true
;}
__INLINE
void
SetSparse
(
ElementType
type
)
{
mem
->
sparse
[
ElementNum
(
type
)]
=
true
;}
__INLINE
INMOST_DATA_ENUM_TYPE
GetPosition
Nu
m
(
INMOST_DATA_ENUM_TYPE
typenum
)
const
{
return
mem
->
pos
[
typenum
];}
__INLINE
INMOST_DATA_ENUM_TYPE
GetPosition
ByDi
m
(
INMOST_DATA_ENUM_TYPE
typenum
)
const
{
return
mem
->
pos
[
typenum
];}
public:
public:
~
Tag
()
{
mem
=
NULL
;}
~
Tag
()
{
mem
=
NULL
;}
Tag
()
{
mem
=
NULL
;}
Tag
()
{
mem
=
NULL
;}
...
@@ -194,7 +193,8 @@ namespace INMOST
...
@@ -194,7 +193,8 @@ namespace INMOST
__INLINE
bool
isSparse
(
ElementType
type
)
const
{
assert
(
mem
!=
NULL
&&
OneType
(
type
));
return
mem
->
sparse
[
ElementNum
(
type
)];}
__INLINE
bool
isSparse
(
ElementType
type
)
const
{
assert
(
mem
!=
NULL
&&
OneType
(
type
));
return
mem
->
sparse
[
ElementNum
(
type
)];}
__INLINE
bool
isValid
()
const
{
return
mem
!=
NULL
;}
__INLINE
bool
isValid
()
const
{
return
mem
!=
NULL
;}
__INLINE
Mesh
*
GetMeshLink
()
const
{
assert
(
mem
!=
NULL
);
return
mem
->
m_link
;}
__INLINE
Mesh
*
GetMeshLink
()
const
{
assert
(
mem
!=
NULL
);
return
mem
->
m_link
;}
__INLINE
bool
isSparseNum
(
INMOST_DATA_ENUM_TYPE
typenum
)
const
{
assert
(
mem
!=
NULL
);
return
mem
->
sparse
[
typenum
];}
__INLINE
bool
isSparseByDim
(
INMOST_DATA_INTEGER_TYPE
typenum
)
const
{
assert
(
mem
!=
NULL
);
return
mem
->
sparse
[
typenum
];}
__INLINE
bool
isDefinedByDim
(
INMOST_DATA_INTEGER_TYPE
typenum
)
const
{
assert
(
mem
!=
NULL
);
return
GetPositionByDim
(
typenum
)
!=
ENUMUNDEF
;}
__INLINE
void
SetBulkDataType
(
INMOST_MPI_Type
type
)
{
assert
(
mem
!=
NULL
&&
mem
->
dtype
==
DATA_BULK
);
mem
->
bulk_data_type
=
type
;}
__INLINE
void
SetBulkDataType
(
INMOST_MPI_Type
type
)
{
assert
(
mem
!=
NULL
&&
mem
->
dtype
==
DATA_BULK
);
mem
->
bulk_data_type
=
type
;}
friend
class
TagManager
;
friend
class
TagManager
;
friend
class
Storage
;
friend
class
Storage
;
...
@@ -552,9 +552,10 @@ namespace INMOST
...
@@ -552,9 +552,10 @@ namespace INMOST
__INLINE
HandleType
&
at
(
size_type
n
)
{
return
container
.
at
(
n
);
}
__INLINE
HandleType
&
at
(
size_type
n
)
{
return
container
.
at
(
n
);
}
__INLINE
HandleType
at
(
size_type
n
)
const
{
return
container
.
at
(
n
);
}
__INLINE
HandleType
at
(
size_type
n
)
const
{
return
container
.
at
(
n
);
}
__INLINE
void
swap
(
ElementArray
<
StorageType
>
&
other
)
{
Mesh
*
t
=
m_link
;
m_link
=
other
.
m_link
;
other
.
m_link
=
t
;
container
.
swap
(
other
.
container
);}
__INLINE
void
swap
(
ElementArray
<
StorageType
>
&
other
)
{
Mesh
*
t
=
m_link
;
m_link
=
other
.
m_link
;
other
.
m_link
=
t
;
container
.
swap
(
other
.
container
);}
__INLINE
void
push_back
(
const
Storage
&
x
)
{
assert
(
x
.
GetMeshLink
()
==
m_link
);
container
.
push_back
(
x
.
GetHandle
());}
__INLINE
void
push_back
(
const
Storage
&
x
)
{
if
(
m_link
==
NULL
)
m_link
=
x
.
GetMeshLink
();
assert
(
x
.
GetMeshLink
()
==
m_link
);
container
.
push_back
(
x
.
GetHandle
());}
//__INLINE void push_back (const StorageType & x) {container.push_back(x.GetHandle());}
//__INLINE void push_back (const StorageType & x) {container.push_back(x.GetHandle());}
__INLINE
void
push_back
(
HandleType
x
)
{
assert
(
m_link
!=
NULL
);
container
.
push_back
(
x
);}
__INLINE
void
push_back
(
HandleType
x
)
{
assert
(
m_link
!=
NULL
);
container
.
push_back
(
x
);}
__INLINE
void
pop_back
()
{
container
.
pop_back
();}
__INLINE
void
resize
(
size_type
n
)
{
container
.
resize
(
n
);}
__INLINE
void
resize
(
size_type
n
)
{
container
.
resize
(
n
);}
__INLINE
bool
empty
()
const
{
return
container
.
empty
();}
__INLINE
bool
empty
()
const
{
return
container
.
empty
();}
__INLINE
void
clear
()
{
container
.
clear
();}
__INLINE
void
clear
()
{
container
.
clear
();}
...
@@ -990,7 +991,7 @@ namespace INMOST
...
@@ -990,7 +991,7 @@ namespace INMOST
void
PutElements
(
const
ElementSet
&
other
)
const
{
PutElements
(
other
->
getHandles
(),
other
->
nbHandles
());}
void
PutElements
(
const
ElementSet
&
other
)
const
{
PutElements
(
other
->
getHandles
(),
other
->
nbHandles
());}
/// Put multiple handles without checking
/// Put multiple handles without checking
template
<
typename
EType
>
template
<
typename
EType
>
void
PutElements
(
const
ElementArray
<
EType
>
&
elems
)
const
{
Pu
sh
Elements
(
elems
.
data
(),
static_cast
<
enumerator
>
(
elems
.
size
()));}
void
PutElements
(
const
ElementArray
<
EType
>
&
elems
)
const
{
Pu
t
Elements
(
elems
.
data
(),
static_cast
<
enumerator
>
(
elems
.
size
()));}
/// Put one element with checking of the existance of duplicate
/// Put one element with checking of the existance of duplicate
/// preserves order for sorted set, thus may be expensive
/// preserves order for sorted set, thus may be expensive
void
AddElement
(
HandleType
e
)
const
;
void
AddElement
(
HandleType
e
)
const
;
...
@@ -1224,12 +1225,12 @@ namespace INMOST
...
@@ -1224,12 +1225,12 @@ namespace INMOST
__INLINE
sparse_type
&
MGetSparseLink
(
HandleType
h
)
{
return
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));}
__INLINE
sparse_type
&
MGetSparseLink
(
HandleType
h
)
{
return
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));}
__INLINE
const
void
*
MGetSparseLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
sparse_type
const
&
s
=
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));
for
(
senum
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
t
.
mem
)
return
s
[
i
].
rec
;
return
NULL
;}
__INLINE
const
void
*
MGetSparseLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
sparse_type
const
&
s
=
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));
for
(
senum
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
t
.
mem
)
return
s
[
i
].
rec
;
return
NULL
;}
__INLINE
void
*
&
MGetSparseLink
(
HandleType
h
,
const
Tag
&
t
)
{
sparse_type
&
s
=
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));
for
(
senum
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
t
.
mem
)
return
s
[
i
].
rec
;
s
.
push_back
(
mkrec
(
t
));
return
s
.
back
().
rec
;}
__INLINE
void
*
&
MGetSparseLink
(
HandleType
h
,
const
Tag
&
t
)
{
sparse_type
&
s
=
MGetSparseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
));
for
(
senum
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
t
.
mem
)
return
s
[
i
].
rec
;
s
.
push_back
(
mkrec
(
t
));
return
s
.
back
().
rec
;}
__INLINE
const
void
*
MGetDenseLink
(
integer
n
,
integer
id
,
const
Tag
&
t
)
const
{
return
&
(
GetDenseData
(
t
.
GetPosition
Nu
m
(
n
))[
links
[
n
][
id
]]);}
__INLINE
const
void
*
MGetDenseLink
(
integer
n
,
integer
id
,
const
Tag
&
t
)
const
{
return
&
(
GetDenseData
(
t
.
GetPosition
ByDi
m
(
n
))[
links
[
n
][
id
]]);}
__INLINE
void
*
MGetDenseLink
(
integer
n
,
integer
id
,
const
Tag
&
t
)
{
return
&
(
GetDenseData
(
t
.
GetPosition
Nu
m
(
n
))[
links
[
n
][
id
]]);}
__INLINE
void
*
MGetDenseLink
(
integer
n
,
integer
id
,
const
Tag
&
t
)
{
return
&
(
GetDenseData
(
t
.
GetPosition
ByDi
m
(
n
))[
links
[
n
][
id
]]);}
__INLINE
const
void
*
MGetDenseLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
return
MGetDenseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
),
t
);}
__INLINE
const
void
*
MGetDenseLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
return
MGetDenseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
),
t
);}
__INLINE
void
*
MGetDenseLink
(
HandleType
h
,
const
Tag
&
t
)
{
return
MGetDenseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
),
t
);}
__INLINE
void
*
MGetDenseLink
(
HandleType
h
,
const
Tag
&
t
)
{
return
MGetDenseLink
(
GetHandleElementNum
(
h
),
GetHandleID
(
h
),
t
);}
__INLINE
const
void
*
MGetLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
if
(
!
t
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
))
)
return
MGetDenseLink
(
h
,
t
);
else
return
MGetSparseLink
(
h
,
t
);}
__INLINE
const
void
*
MGetLink
(
HandleType
h
,
const
Tag
&
t
)
const
{
if
(
!
t
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
))
)
return
MGetDenseLink
(
h
,
t
);
else
return
MGetSparseLink
(
h
,
t
);}
__INLINE
void
*
MGetLink
(
HandleType
h
,
const
Tag
&
t
)
{
if
(
!
t
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
))
)
return
MGetDenseLink
(
h
,
t
);
else
{
void
*
&
q
=
MGetSparseLink
(
h
,
t
);
if
(
q
==
NULL
)
q
=
calloc
(
1
,
t
.
GetRecordSize
());
return
q
;}}
__INLINE
void
*
MGetLink
(
HandleType
h
,
const
Tag
&
t
)
{
if
(
!
t
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
))
)
return
MGetDenseLink
(
h
,
t
);
else
{
void
*
&
q
=
MGetSparseLink
(
h
,
t
);
if
(
q
==
NULL
)
q
=
calloc
(
1
,
t
.
GetRecordSize
());
return
q
;}}
public:
public:
Mesh
();
Mesh
();
Mesh
(
const
Mesh
&
other
);
Mesh
(
const
Mesh
&
other
);
...
@@ -2602,6 +2603,13 @@ namespace INMOST
...
@@ -2602,6 +2603,13 @@ namespace INMOST
MarkerType
NewMarker
()
const
{
return
new_element
;}
MarkerType
NewMarker
()
const
{
return
new_element
;}
void
SwapModification
();
// swap hidden and new elements, so that old mesh is recovered
void
SwapModification
();
// swap hidden and new elements, so that old mesh is recovered
void
BeginModification
();
//allow elements to be hidden
void
BeginModification
();
//allow elements to be hidden
/// After this function any link to deleted element will be replaced by InvalidHandle()
/// TODO:
/// 1) maybe instead of forming set of deleted elements and subtracting set from other sets it is better
/// to remove each modified element
/// (done, check and compare)
/// 2) parent/child elements in set would not be replaced or reconnected, this may lead to wrong behavior
/// (done, check and compare)
void
ApplyModification
();
//modify DATA_REFERENCE tags so that links to hidden elements are converted to NULL and removed from sets
void
ApplyModification
();
//modify DATA_REFERENCE tags so that links to hidden elements are converted to NULL and removed from sets
/// This function is not yet implemented. It should correctly resolve parallel state of
/// This function is not yet implemented. It should correctly resolve parallel state of
/// newly created elements, provide them valid global identificators, resolve owners of
/// newly created elements, provide them valid global identificators, resolve owners of
...
...
iterator.cpp
View file @
fd3c0eee
...
@@ -180,13 +180,8 @@ namespace INMOST
...
@@ -180,13 +180,8 @@ namespace INMOST
if
(
lid
==
m
->
LastLocalID
(
etype
)
)
if
(
lid
==
m
->
LastLocalID
(
etype
)
)
{
{
etype
=
GetNextType
(
etype
,
types
);
etype
=
GetNextType
(
etype
,
types
);
if
(
etype
)
lid
=
-
1
;
lid
=
0
;
if
(
!
etype
)
break
;
else
{
lid
=
-
1
;
break
;
}
}
}
else
break
;
else
break
;
}
}
...
@@ -243,7 +238,7 @@ namespace INMOST
...
@@ -243,7 +238,7 @@ namespace INMOST
Mesh
::
iteratorStorage
Mesh
::
Begin
(
ElementType
Types
)
{
return
base_iterator
<
Storage
>
(
Types
,
this
,
false
);}
Mesh
::
iteratorStorage
Mesh
::
Begin
(
ElementType
Types
)
{
return
base_iterator
<
Storage
>
(
Types
,
this
,
false
);}
Mesh
::
iteratorStorage
Mesh
::
End
()
{
return
base_iterator
<
Storage
>
(
this
);}
Mesh
::
iteratorStorage
Mesh
::
End
()
{
return
base_iterator
<
Storage
>
(
this
);}
Mesh
::
iteratorElement
Mesh
::
BeginElement
(
ElementType
Types
)
{
return
base_iterator
<
Element
>
(
Types
&
(
NODE
|
EDGE
|
FACE
|
CELL
),
this
,
false
);}
Mesh
::
iteratorElement
Mesh
::
BeginElement
(
ElementType
Types
)
{
return
base_iterator
<
Element
>
(
Types
&
(
NODE
|
EDGE
|
FACE
|
CELL
|
ESET
),
this
,
false
);}
Mesh
::
iteratorElement
Mesh
::
EndElement
()
{
return
base_iterator
<
Element
>
(
this
);}
Mesh
::
iteratorElement
Mesh
::
EndElement
()
{
return
base_iterator
<
Element
>
(
this
);}
Mesh
::
iteratorSet
Mesh
::
BeginSet
()
{
return
base_iterator
<
ElementSet
>
(
ESET
,
this
,
false
);}
Mesh
::
iteratorSet
Mesh
::
BeginSet
()
{
return
base_iterator
<
ElementSet
>
(
ESET
,
this
,
false
);}
Mesh
::
iteratorSet
Mesh
::
EndSet
()
{
return
base_iterator
<
ElementSet
>
(
this
);}
Mesh
::
iteratorSet
Mesh
::
EndSet
()
{
return
base_iterator
<
ElementSet
>
(
this
);}
...
...
mesh.cpp
View file @
fd3c0eee
...
@@ -1361,8 +1361,8 @@ namespace INMOST
...
@@ -1361,8 +1361,8 @@ namespace INMOST
if
(
e
->
GetName
()
==
name
)
if
(
e
->
GetName
()
==
name
)
return
std
::
make_pair
(
e
->
self
(),
false
);
return
std
::
make_pair
(
e
->
self
(),
false
);
}
}
HandleType
he
=
TieElement
(
4
);
HandleType
he
=
ComposeHandle
(
4
,
TieElement
(
4
)
)
;
bulk_array
set_name
=
BulkArrayD
F
(
he
,
SetNameTag
());
bulk_array
set_name
=
BulkArrayD
V
(
he
,
SetNameTag
());
set_name
.
resize
(
static_cast
<
bulk_array
::
size_type
>
(
name
.
size
()));
set_name
.
resize
(
static_cast
<
bulk_array
::
size_type
>
(
name
.
size
()));
memcpy
(
set_name
.
data
(),
name
.
c_str
(),
name
.
size
());
memcpy
(
set_name
.
data
(),
name
.
c_str
(),
name
.
size
());
HighConn
(
he
).
resize
(
ElementSet
::
high_conn_reserved
);
//Allocate initial space for parent/sibling/child/unsorted info
HighConn
(
he
).
resize
(
ElementSet
::
high_conn_reserved
);
//Allocate initial space for parent/sibling/child/unsorted info
...
@@ -1469,12 +1469,15 @@ namespace INMOST
...
@@ -1469,12 +1469,15 @@ namespace INMOST
back_links
[
etypenum
][
old_addr
]
=
-
1
;
back_links
[
etypenum
][
old_addr
]
=
-
1
;
back_links
[
etypenum
][
new_addr
]
=
ID
;
back_links
[
etypenum
][
new_addr
]
=
ID
;
links
[
etypenum
][
ID
]
=
new_addr
;
links
[
etypenum
][
ID
]
=
new_addr
;
#if !defined(LAZY_SPARSE_ALLOCATION)
if
(
!
sparse_data
[
etypenum
].
empty
()
)
#endif
sparse_data
[
etypenum
][
new_addr
].
swap
(
sparse_data
[
etypenum
][
old_addr
]);
sparse_data
[
etypenum
][
new_addr
].
swap
(
sparse_data
[
etypenum
][
old_addr
]);
for
(
Mesh
::
iteratorTag
t
=
BeginTag
();
t
!=
EndTag
();
t
++
)
for
(
Mesh
::
iteratorTag
t
=
BeginTag
();
t
!=
EndTag
();
t
++
)
{
{
if
(
!
t
->
isSparse
Nu
m
(
etypenum
)
)
if
(
!
t
->
isSparse
ByDi
m
(
etypenum
)
)
{
{
INMOST_DATA_ENUM_TYPE
data_pos
=
t
->
GetPosition
Nu
m
(
etypenum
);
INMOST_DATA_ENUM_TYPE
data_pos
=
t
->
GetPosition
ByDi
m
(
etypenum
);
if
(
data_pos
==
ENUMUNDEF
)
continue
;
if
(
data_pos
==
ENUMUNDEF
)
continue
;
TagManager
::
dense_sub_type
&
arr
=
GetDenseData
(
data_pos
);
TagManager
::
dense_sub_type
&
arr
=
GetDenseData
(
data_pos
);
INMOST_DATA_ENUM_TYPE
record_size
=
t
->
GetRecordSize
();
INMOST_DATA_ENUM_TYPE
record_size
=
t
->
GetRecordSize
();
...
@@ -1636,14 +1639,14 @@ namespace INMOST
...
@@ -1636,14 +1639,14 @@ namespace INMOST
{
{
Asserts
(
h
,
tag
,
expected
);
Asserts
(
h
,
tag
,
expected
);
assert
(
tag
.
GetSize
()
==
ENUMUNDEF
);
//data is of variable size
assert
(
tag
.
GetSize
()
==
ENUMUNDEF
);
//data is of variable size
assert
(
!
tag
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
)));
//tag is not sparse
assert
(
!
tag
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
)));
//tag is not sparse
}
}
void
Mesh
::
AssertsDF
(
HandleType
h
,
const
Tag
&
tag
,
DataType
expected
)
const
void
Mesh
::
AssertsDF
(
HandleType
h
,
const
Tag
&
tag
,
DataType
expected
)
const
{
{
Asserts
(
h
,
tag
,
expected
);
Asserts
(
h
,
tag
,
expected
);
assert
(
tag
.
GetSize
()
!=
ENUMUNDEF
);
//data is of variable size
assert
(
tag
.
GetSize
()
!=
ENUMUNDEF
);
//data is of variable size
assert
(
!
tag
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
)));
//tag is not sparse
assert
(
!
tag
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
)));
//tag is not sparse
}
}
void
Mesh
::
Asserts
(
HandleType
h
,
const
Tag
&
tag
,
DataType
expected
)
const
void
Mesh
::
Asserts
(
HandleType
h
,
const
Tag
&
tag
,
DataType
expected
)
const
...
@@ -1653,7 +1656,7 @@ namespace INMOST
...
@@ -1653,7 +1656,7 @@ namespace INMOST
assert
(
tag
.
isValid
());
//tag was allocated
assert
(
tag
.
isValid
());
//tag was allocated
assert
(
this
==
tag
.
GetMeshLink
());
//tag is not mine
assert
(
this
==
tag
.
GetMeshLink
());
//tag is not mine
assert
(
tag
.
GetDataType
()
==
expected
);
//tag data type coinside with expected data type
assert
(
tag
.
GetDataType
()
==
expected
);
//tag data type coinside with expected data type
assert
(
tag
.
isDefined
(
GetHandleElement
Type
(
h
)));
//tag data type coinside with expected data type
assert
(
tag
.
isDefined
ByDim
(
GetHandleElement
Num
(
h
)));
//tag data type coinside with expected data type
}
}
void
Mesh
::
ClearMarkerSpace
(
HandleType
h
)
void
Mesh
::
ClearMarkerSpace
(
HandleType
h
)
...
@@ -1754,7 +1757,7 @@ namespace INMOST
...
@@ -1754,7 +1757,7 @@ namespace INMOST
void
Mesh
::
DelDenseData
(
HandleType
h
,
const
Tag
&
tag
)
void
Mesh
::
DelDenseData
(
HandleType
h
,
const
Tag
&
tag
)
{
{
assert
(
tag
.
GetMeshLink
()
==
this
);
assert
(
tag
.
GetMeshLink
()
==
this
);
assert
(
!
tag
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
))
);
assert
(
!
tag
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
))
);
void
*
data
=
MGetLink
(
h
,
tag
);
void
*
data
=
MGetLink
(
h
,
tag
);
if
(
data
!=
NULL
)
if
(
data
!=
NULL
)
{
{
...
@@ -1769,7 +1772,7 @@ namespace INMOST
...
@@ -1769,7 +1772,7 @@ namespace INMOST
void
Mesh
::
DelSparseData
(
HandleType
h
,
const
Tag
&
tag
)
void
Mesh
::
DelSparseData
(
HandleType
h
,
const
Tag
&
tag
)
{
{
assert
(
tag
.
GetMeshLink
()
==
this
);
assert
(
tag
.
GetMeshLink
()
==
this
);
assert
(
tag
.
isSparse
Nu
m
(
GetHandleElementNum
(
h
))
);
assert
(
tag
.
isSparse
ByDi
m
(
GetHandleElementNum
(
h
))
);
sparse_type
&
s
=
MGetSparseLink
(
h
);
sparse_type
&
s
=
MGetSparseLink
(
h
);
for
(
sparse_type
::
size_type
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
tag
.
mem
)
for
(
sparse_type
::
size_type
i
=
0
;
i
<
s
.
size
();
++
i
)
if
(
s
[
i
].
tag
==
tag
.
mem
)
{
{
...
@@ -1793,7 +1796,7 @@ namespace INMOST
...
@@ -1793,7 +1796,7 @@ namespace INMOST
bool
Mesh
::
HaveData
(
HandleType
h
,
const
Tag
&
tag
)
const
bool
Mesh
::
HaveData
(
HandleType
h
,
const
Tag
&
tag
)
const
{
{
integer
n
=
GetHandleElementNum
(
h
);
integer
n
=
GetHandleElementNum
(
h
);
if
(
tag
.
isSparse
Nu
m
(
n
))
if
(
tag
.
isSparse
ByDi
m
(
n
))
{
{
if
(
MGetSparseLink
(
h
,
tag
)
!=
NULL
)
if
(
MGetSparseLink
(
h
,
tag
)
!=
NULL
)
return
true
;
return
true
;
...
@@ -1801,7 +1804,7 @@ namespace INMOST
...
@@ -1801,7 +1804,7 @@ namespace INMOST
}
}
else
else
{
{
if
(
tag
.
GetPosition
Nu
m
(
n
)
!=
ENUMUNDEF
)
if
(
tag
.
GetPosition
ByDi
m
(
n
)
!=
ENUMUNDEF
)
return
true
;
return
true
;
return
false
;
return
false
;
}
}
...
...
mesh_file.cpp
View file @
fd3c0eee
...
@@ -1510,7 +1510,7 @@ ecl_exit_loop:
...
@@ -1510,7 +1510,7 @@ ecl_exit_loop:
{
{
e_nodes
.
at
(
0
)
=
newnodes
[
cp
[
k
]];
e_nodes
.
at
(
0
)
=
newnodes
[
cp
[
k
]];
e_nodes
.
at
(
1
)
=
newnodes
[
cp
[
k
+
1
]];
e_nodes
.
at
(
1
)
=
newnodes
[
cp
[
k
+
1
]];
//
eset->
Inser
t(CreateEdge(e_nodes).first);
eset
->
PutElemen
t
(
CreateEdge
(
e_nodes
).
first
);
RemMarker
(
newnodes
[
cp
[
k
]],
unused_marker
);
RemMarker
(
newnodes
[
cp
[
k
]],
unused_marker
);
}
}
RemMarker
(
newnodes
[
cp
[
j
+
cp
[
j
]]],
unused_marker
);
RemMarker
(
newnodes
[
cp
[
j
+
cp
[
j
]]],
unused_marker
);
...
@@ -1993,8 +1993,8 @@ ecl_exit_loop:
...
@@ -1993,8 +1993,8 @@ ecl_exit_loop:
if
(
GetHandleElementType
(
newcells
[
i
])
&
ESET
)
if
(
GetHandleElementType
(
newcells
[
i
])
&
ESET
)
{
{
ElementSet
set
=
ElementSet
(
this
,
newcells
[
i
]);
ElementSet
set
=
ElementSet
(
this
,
newcells
[
i
]);
/*
for(ElementSet::iterator it = set->
b
egin(); it != set->
e
nd(); ++it)
for
(
ElementSet
::
iterator
it
=
set
->
B
egin
();
it
!=
set
->
E
nd
();
++
it
)
{
{
for
(
std
::
vector
<
Tag
>::
iterator
jt
=
datatags
.
begin
();
jt
!=
datatags
.
end
();
++
jt
)
for
(
std
::
vector
<
Tag
>::
iterator
jt
=
datatags
.
begin
();
jt
!=
datatags
.
end
();
++
jt
)
{
{
...
@@ -2009,14 +2009,14 @@ ecl_exit_loop:
...
@@ -2009,14 +2009,14 @@ ecl_exit_loop:
{
{
Storage
::
integer_array
arra
=
it
->
IntegerArray
(
*
jt
);
Storage
::
integer_array
arra
=
it
->
IntegerArray
(
*
jt
);
Storage
::
integer_array
arrb
=
set
->
IntegerArray
(
*
jt
);
Storage
::
integer_array
arrb
=
set
->
IntegerArray
(
*
jt
);
for(
int
k = 0; k < jt->GetSize(); k++) arra[k] = arrb[k];
for
(
enumerator
k
=
0
;
k
<
jt
->
GetSize
();
k
++
)
arra
[
k
]
=
arrb
[
k
];
}
}
break
;
break
;
case
DATA_REAL
:
case
DATA_REAL
:
{
{
Storage
::
real_array
arra
=
it
->
RealArray
(
*
jt
);
Storage
::
real_array
arra
=
it
->
RealArray
(
*
jt
);
Storage
::
real_array
arrb
=
set
->
RealArray
(
*
jt
);
Storage
::
real_array
arrb
=
set
->
RealArray
(
*
jt
);
for(
int
k = 0; k < jt->GetSize(); k++) arra[k] = arrb[k];
for
(
enumerator
k
=
0
;
k
<
jt
->
GetSize
();
k
++
)
arra
[
k
]
=
arrb
[
k
];
}
}
break
;
break
;
default:
default:
...
@@ -2025,7 +2025,7 @@ ecl_exit_loop:
...
@@ -2025,7 +2025,7 @@ ecl_exit_loop:
}
}
}
}
}
}
*/
Destroy
(
newcells
[
i
]);
Destroy
(
newcells
[
i
]);
}
}
}
}
...
@@ -4253,6 +4253,8 @@ safe_output:
...
@@ -4253,6 +4253,8 @@ safe_output:
REPORT_VAL
(
"tag_size"
,
header
[
6
]);
REPORT_VAL
(
"tag_size"
,
header
[
6
]);
for
(
Mesh
::
iteratorTag
it
=
BeginTag
();
it
!=
EndTag
();
it
++
)
for
(
Mesh
::
iteratorTag
it
=
BeginTag
();
it
!=
EndTag
();
it
++
)
{
{
//don't forget to change header[6] if you skip more
//should match with content after MeshDataHeader
if
(
*
it
==
set_id
)
continue
;
if
(
*
it
==
set_id
)
continue
;
if
(
*
it
==
HighConnTag
()
)
continue
;
if
(
*
it
==
HighConnTag
()
)
continue
;
if
(
*
it
==
LowConnTag
()
)
continue
;
if
(
*
it
==
LowConnTag
()
)
continue
;
...
@@ -4407,10 +4409,12 @@ safe_output:
...
@@ -4407,10 +4409,12 @@ safe_output:
for
(
Mesh
::
iteratorTag
jt
=
BeginTag
();
jt
!=
EndTag
();
jt
++
)
for
(
Mesh
::
iteratorTag
jt
=
BeginTag
();
jt
!=
EndTag
();
jt
++
)
{
{
std
::
string
tagname
=
jt
->
GetTagName
();
std
::
string
tagname
=
jt
->
GetTagName
();
//skipping should match with header[6] and content
// after TagsHeader
if
(
*
jt
==
set_id
)
continue
;
if
(
*
jt
==
set_id
)
continue
;
if
(
*
jt
==
HighConnTag
()
)
continue
;
if
(
*
jt
==
HighConnTag
()
)
continue
;
if
(
*
jt
==
LowConnTag
()
)
continue
;
if
(
*
jt
==
LowConnTag
()
)
continue
;
REPORT_VAL
(
"TagName"
,
jt
->
GetT
ag
N
ame
()
);
REPORT_VAL
(
"TagName"
,
t
ag
n
ame
);
for
(
ElementType
etype
=
NODE
;
etype
<=
MESH
;
etype
=
etype
<<
1
)
for
(
ElementType
etype
=
NODE
;
etype
<=
MESH
;
etype
=
etype
<<
1
)
if
(
jt
->
isDefined
(
etype
)
)
if
(
jt
->
isDefined
(
etype
)
)
{
{
...
...
modify.cpp
View file @
fd3c0eee
...
@@ -2006,6 +2006,7 @@ public:
...
@@ -2006,6 +2006,7 @@ public:
}
}
}
}
//need to gather the set of deleted elements
//need to gather the set of deleted elements
/*//old approach
ElementSet erase = CreateSet("TEMPORARY_ERASE_SET").first;
ElementSet erase = CreateSet("TEMPORARY_ERASE_SET").first;
for(ElementType etype = NODE; etype <= ESET; etype = etype << 1)
for(ElementType etype = NODE; etype <= ESET; etype = etype << 1)
{
{
...
@@ -2017,9 +2018,25 @@ public:
...
@@ -2017,9 +2018,25 @@ public:
//in case any algorithm further will use this fact (Subtract currently would not use this fact)
//in case any algorithm further will use this fact (Subtract currently would not use this fact)
//but may use by retriving lower_bound/higher_bound O(log(n)) operations to narrow performed operations
//but may use by retriving lower_bound/higher_bound O(log(n)) operations to narrow performed operations
erase->BulkDF(SetComparatorTag()) = ElementSet::HANDLE_COMPARATOR;
erase->BulkDF(SetComparatorTag()) = ElementSet::HANDLE_COMPARATOR;
*/
for
(
Mesh
::
iteratorSet
it
=
BeginSet
();
it
!=
EndSet
();
it
++
)
for
(
Mesh
::
iteratorSet
it
=
BeginSet
();
it
!=
EndSet
();
it
++
)