Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tnl-dev
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
TNL
tnl-dev
Commits
fc01af34
There was an error fetching the commit references. Please try again later.
Commit
fc01af34
authored
9 years ago
by
Tomáš Oberhuber
Browse files
Options
Downloads
Patches
Plain Diff
Refactoring the mesh.
parent
4967324e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mesh/tnlMesh.h
+24
-52
24 additions, 52 deletions
src/mesh/tnlMesh.h
src/mesh/tnlMesh_impl.h
+89
-0
89 additions, 0 deletions
src/mesh/tnlMesh_impl.h
with
113 additions
and
52 deletions
src/mesh/tnlMesh.h
+
24
−
52
View file @
fc01af34
...
...
@@ -33,60 +33,39 @@ class tnlMesh : public tnlObject,
public:
typedef
MeshConfig
Config
;
typedef
tnlMeshTraits
<
MeshConfig
>
MeshTraits
;
typedef
typename
tnlMeshTraits
<
MeshConfig
>::
CellType
CellType
;
typedef
typename
tnlMeshTraits
<
MeshConfig
>::
PointType
PointType
;
static
const
int
dimensions
=
MeshTraits
::
meshDimensions
;
template
<
int
Dimensions
>
using
EntityTraits
=
typename
MeshTraits
::
template
EntityTraits
<
Dimensions
>;
static
tnlString
getType
();
virtual
tnlString
getTypeVirtual
()
const
{
return
this
->
getType
();
}
virtual
tnlString
getTypeVirtual
()
const
;
static
constexpr
int
getDimensions
();
using
tnlObject
::
save
;
using
tnlObject
::
load
;
template
<
int
Dimensions
>
bool
entitiesAvalable
()
const
;
bool
save
(
tnlFile
&
file
)
const
{
if
(
!
tnlObject
::
save
(
file
)
||
!
entitiesStorage
.
save
(
file
)
)
{
cerr
<<
"Mesh saving failed."
<<
endl
;
return
false
;
}
return
true
;
}
// TODO: jeden GlobalIndexType a LocalIndexType pro vsechny entity
typename
EntityTraits
<
dimensions
>::
GlobalIndexType
getNumberOfCells
()
const
;
bool
load
(
tnlFile
&
file
)
{
if
(
!
tnlObject
::
load
(
file
)
||
!
entitiesStorage
.
load
(
file
)
)
{
cerr
<<
"Mesh loading failed."
<<
endl
;
return
false
;
}
return
true
;
}
template
<
int
Dimensions
>
typename
EntityTraits
<
Dimensions
>::
GlobalIndexType
getNumberOfEntities
()
const
;
CellType
&
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
entityIndex
);
const
CellType
&
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
entityIndex
)
const
;
static
const
int
getDimensions
();
template
<
int
Dimensions
>
bool
entitiesAvalable
()
const
{
return
MeshTraits
::
template
EntityTraits
<
Dimensions
>
::
available
;
}
template
<
int
Dimensi
ons
>
typename
MeshTraits
::
template
EntityTraits
<
Dimensions
>
::
GlobalIndexType
getNumberOfEntities
()
const
{
return
entitiesStorage
.
getNumberOfEntities
(
tnlDimensionsTag
<
Dimensions
>
()
);
}
bool
save
(
tnlFile
&
file
)
c
ons
t
;
bool
load
(
tnlFile
&
file
);
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
getNumberOfCells
()
const
{
return
entitiesStorage
.
getNumberOfEntities
(
tnlDimensionsTag
<
dimensions
>
()
);
}
template
<
int
Dimensions
>
typename
MeshTraits
::
template
EntityTraits
<
Dimensions
>
::
EntityType
&
...
...
@@ -116,17 +95,6 @@ class tnlMesh : public tnlObject,
return
entitiesStorage
.
getEntities
(
tnlDimensionsTag
<
Dimensions
>
()
);
}
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
EntityType
&
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
entityIndex
)
{
return
entitiesStorage
.
getEntity
(
tnlDimensionsTag
<
dimensions
>
(),
entityIndex
);
}
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
EntityType
&
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
entityIndex
)
const
{
return
entitiesStorage
.
getEntity
(
tnlDimensionsTag
<
dimensions
>
(),
entityIndex
);
}
void
print
(
ostream
&
str
)
const
{
...
...
@@ -161,6 +129,10 @@ class tnlMesh : public tnlObject,
return
meshInitializer
.
createMesh
(
points
,
cellSeeds
,
*
this
);
}
using
tnlObject
::
save
;
using
tnlObject
::
load
;
protected
:
tnlMeshStorageLayers
<
MeshConfig
>
entitiesStorage
;
...
...
This diff is collapsed.
Click to expand it.
src/mesh/tnlMesh_impl.h
+
89
−
0
View file @
fc01af34
...
...
@@ -30,6 +30,95 @@ getType()
return
tnlString
(
"tnlMesh< "
)
+
MeshConfig
::
getType
()
+
" >"
;
}
template
<
typename
MeshConfig
>
tnlString
tnlMesh
<
MeshConfig
>::
getTypeVirtual
()
const
{
return
this
->
getType
();
}
template
<
typename
MeshConfig
>
constexpr
int
tnlMesh
<
MeshConfig
>::
getDimensions
()
{
return
dimensions
;
}
template
<
typename
MeshConfig
>
template
<
int
Dimensions
>
bool
tnlMesh
<
MeshConfig
>::
entitiesAvalable
()
const
{
return
MeshTraits
::
template
EntityTraits
<
Dimensions
>
::
available
;
}
template
<
typename
MeshConfig
>
template
<
int
Dimensions
>
typename
tnlMesh
<
MeshConfig
>::
template
EntityTraits
<
Dimensions
>
::
GlobalIndexType
tnlMesh
<
MeshConfig
>::
getNumberOfEntities
()
const
{
return
entitiesStorage
.
getNumberOfEntities
(
tnlDimensionsTag
<
Dimensions
>
()
);
}
template
<
typename
MeshConfig
>
typename
tnlMesh
<
MeshConfig
>::
template
EntityTraits
<
tnlMesh
<
MeshConfig
>
::
dimensions
>::
GlobalIndexType
tnlMesh
<
MeshConfig
>::
getNumberOfCells
()
const
{
return
entitiesStorage
.
getNumberOfEntities
(
tnlDimensionsTag
<
dimensions
>
()
);
}
template
<
typename
MeshConfig
>
typename
tnlMesh
<
MeshConfig
>::
CellType
&
tnlMesh
<
MeshConfig
>::
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
cellIndex
)
{
return
entitiesStorage
.
getEntity
(
tnlDimensionsTag
<
dimensions
>
(),
cellIndex
);
}
template
<
typename
MeshConfig
>
const
typename
tnlMesh
<
MeshConfig
>::
CellType
&
tnlMesh
<
MeshConfig
>::
getCell
(
const
typename
MeshTraits
::
template
EntityTraits
<
dimensions
>
::
GlobalIndexType
cellIndex
)
const
{
return
entitiesStorage
.
getEntity
(
tnlDimensionsTag
<
dimensions
>
(),
cellIndex
);
}
template
<
typename
MeshConfig
>
bool
tnlMesh
<
MeshConfig
>::
save
(
tnlFile
&
file
)
const
{
if
(
!
tnlObject
::
save
(
file
)
||
!
entitiesStorage
.
save
(
file
)
)
{
cerr
<<
"Mesh saving failed."
<<
endl
;
return
false
;
}
return
true
;
}
template
<
typename
MeshConfig
>
bool
tnlMesh
<
MeshConfig
>::
load
(
tnlFile
&
file
)
{
if
(
!
tnlObject
::
load
(
file
)
||
!
entitiesStorage
.
load
(
file
)
)
{
cerr
<<
"Mesh loading failed."
<<
endl
;
return
false
;
}
return
true
;
}
#endif
/* TNLMESH_IMPL_H */
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment