Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
R
redesign-prototype
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nektar
redesign-prototype
Commits
ba58bf73
Commit
ba58bf73
authored
2 years ago
by
Dave Moxey
Browse files
Options
Downloads
Patches
Plain Diff
Rework a bit so that Field has multiple components
parent
6d02d9bb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Field.hpp
+24
-13
24 additions, 13 deletions
Field.hpp
MemRefCPU.hpp
+1
-0
1 addition, 0 deletions
MemRefCPU.hpp
main.cpp
+5
-2
5 additions, 2 deletions
main.cpp
with
30 additions
and
15 deletions
Field.hpp
+
24
−
13
View file @
ba58bf73
...
...
@@ -20,34 +20,45 @@ struct StatePhys;
struct
StateCoeff
;
using
DefaultState
=
StatePhys
;
struct
CollectionInfo
{
size_t
offset
;
// other polynomial order stuff
enum
ShapeType
{
eQuadrilateral
,
eTriangle
};
struct
VariableInfo
{
std
::
string
name
;
struct
BlockAttributes
{
ShapeType
shape
;
std
::
array
<
int
,
3
>
dofs
;
size_t
num_elements
;
};
template
<
typename
TType
=
double
,
typename
TState
=
DefaultState
,
typename
tBackend
=
DefaultBackend
>
class
Field
{
public:
Field
(
)
:
m_storage
(
10
)
Field
(
std
::
vector
<
BlockAttributes
>
&
blocks
)
:
block_attributes
(
blocks
),
m_storage
(
blocks
.
size
()
)
{
for
(
int
i
=
0
;
i
<
blocks
.
size
();
++
i
)
{
auto
&
block
=
blocks
[
i
];
size_t
blockSize
=
block
.
num_elements
*
block
.
dofs
[
0
]
*
block
.
dofs
[
1
]
*
block
.
dofs
[
2
];
// wasteful but an upper bound
m_storage
[
i
]
=
MemRef
<
TType
,
tBackend
>
(
blockSize
);
}
}
Field
(
const
Field
&
)
=
default
;
~
Field
()
=
default
;
MemRef
<
TType
,
tBackend
>
&
GetStorage
()
MemRef
<
TType
,
tBackend
>
&
GetStorage
(
size_t
i
)
{
return
m_storage
;
return
m_storage
[
i
]
;
}
private
:
MemRef
<
TType
,
tBackend
>
m_storage
;
size_t
GetNumComponents
()
{
return
component_names
.
size
();
}
std
::
vector
<
CollectionInfo
>
coll_info
;
size_t
nvar
;
std
::
vector
<
VariableInfo
>
var_info
;
private
:
std
::
vector
<
MemRef
<
TType
,
tBackend
>>
m_storage
;
std
::
vector
<
BlockAttributes
>
block_attributes
;
std
::
vector
<
std
::
string
>
component_names
;
};
This diff is collapsed.
Click to expand it.
MemRefCPU.hpp
+
1
−
0
View file @
ba58bf73
...
...
@@ -5,6 +5,7 @@ template<typename tData>
class
MemRef
<
tData
,
BackendCPU
>
{
public:
MemRef
()
{}
MemRef
(
size_t
n
)
{
m_host
=
new
tData
[
n
];
...
...
This diff is collapsed.
Click to expand it.
main.cpp
+
5
−
2
View file @
ba58bf73
#include
<boost/core/demangle.hpp>
#include
<iostream>
...
...
@@ -10,8 +11,10 @@ int main() {
using
DefaultMethod
=
MethodLocMat
;
using
TData
=
double
;
Field
<
double
,
StateCoeff
>
in
;
Field
<
double
,
StatePhys
>
out
;
std
::
vector
<
BlockAttributes
>
blocks
=
{
{
eQuadrilateral
,
{
4
,
4
,
4
},
100
}
};
Field
<
double
,
StateCoeff
>
in
(
blocks
);
Field
<
double
,
StatePhys
>
out
(
blocks
);
auto
test2
=
std
::
make_shared
<
Operator
<
double
,
OpBwdTrans
>>
();
auto
test
=
std
::
dynamic_pointer_cast
<
OperatorBase
<
Operator
<
double
,
OpBwdTrans
>
,
double
,
StateCoeff
,
StatePhys
>>
(
test2
);
...
...
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