Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD 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
Show more breadcrumbs
Timo Koch
dune-common
Commits
f59b1c41
Commit
f59b1c41
authored
19 years ago
by
Peter Bastian
Browse files
Options
Downloads
Patches
Plain Diff
added VTK output to functions
[[Imported from SVN: r4391]]
parent
0af86f5b
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
disc/functions/functions.hh
+49
-0
49 additions, 0 deletions
disc/functions/functions.hh
disc/functions/p0function.hh
+10
-2
10 additions, 2 deletions
disc/functions/p0function.hh
disc/functions/p1function.hh
+8
-0
8 additions, 0 deletions
disc/functions/p1function.hh
with
67 additions
and
2 deletions
disc/functions/functions.hh
+
49
−
0
View file @
f59b1c41
...
...
@@ -10,6 +10,8 @@
#include
"common/exceptions.hh"
#include
"grid/common/grid.hh"
#include
"grid/utility/hierarchicsearch.hh"
#include
"dune/io/file/vtk/vtkwriter.hh"
/**
* @file dune/disc/functions/functions.hh
...
...
@@ -518,6 +520,53 @@ namespace Dune
};
// Wrapper for VTK output of grid functions
template
<
class
GridImp
,
class
IS
,
class
RT
,
int
m
>
class
VTKGridFunctionWrapper
:
public
VTKWriter
<
GridImp
,
IS
>::
VTKFunction
{
enum
{
n
=
GridImp
::
dimension
};
typedef
typename
GridImp
::
ctype
DT
;
typedef
typename
GridImp
::
Traits
::
template
Codim
<
0
>
::
Entity
Entity
;
public
:
//! return number of components
virtual
int
ncomps
()
const
{
return
m
;
}
//! evaluate single component comp in the entity e at local coordinates xi
/*! Evaluate the function in an entity at local coordinates.
@param[in] comp number of component to be evaluated
@param[in] e reference to grid entity of codimension 0
@param[in] xi point in local coordinates of the reference element of e
\return value of the component
*/
virtual
double
evaluate
(
int
comp
,
const
Entity
&
e
,
const
Dune
::
FieldVector
<
DT
,
n
>&
xi
)
const
{
return
func
.
evallocal
(
comp
,
e
,
xi
);
}
// get name
virtual
std
::
string
name
()
const
{
return
myname
;
}
// constructor remembers reference to a grid function
VTKGridFunctionWrapper
(
const
GridFunction
<
GridImp
,
RT
,
m
>&
f
,
std
::
string
s
)
:
func
(
f
),
myname
(
s
)
{}
virtual
~
VTKGridFunctionWrapper
()
{}
private
:
const
GridFunction
<
GridImp
,
RT
,
m
>&
func
;
std
::
string
myname
;
};
/** @} */
...
...
This diff is collapsed.
Click to expand it.
disc/functions/p0function.hh
+
10
−
2
View file @
f59b1c41
...
...
@@ -22,6 +22,7 @@
#include
"dune/istl/operators.hh"
#include
"dune/istl/bcrsmatrix.hh"
#include
"dune/disc/shapefunctions/lagrangeshapefunctions.hh"
#include
"dune/io/file/vtk/vtkwriter.hh"
// same directory includes
#include
"functions.hh"
...
...
@@ -97,7 +98,7 @@ namespace Dune
std
::
cerr
<<
"not enough memory in P0Function"
<<
std
::
endl
;
throw
;
// rethrow exception
}
std
::
cout
<<
"making function with "
<<
mapper_
.
size
()
<<
" components"
<<
std
::
endl
;
//
std::cout << "making function with " << mapper_.size() << " components" << std::endl;
}
//! create function with initialization from a vector
...
...
@@ -113,7 +114,7 @@ namespace Dune
std
::
cerr
<<
"not enough memory in P0Function"
<<
std
::
endl
;
throw
;
// rethrow exception
}
std
::
cout
<<
"making function with "
<<
mapper_
.
size
()
<<
" components"
<<
std
::
endl
;
//
std::cout << "making function with " << mapper_.size() << " components" << std::endl;
// check size of initialization vector
if
(
v
.
size
()
!=
(
unsigned
int
)
mapper_
.
size
())
...
...
@@ -251,6 +252,13 @@ namespace Dune
return
mapper_
;
}
//! VTK output
void
vtkout
(
VTKWriter
<
G
,
IS
>&
vtkwriter
,
std
::
string
s
)
{
typename
VTKWriter
<
G
,
IS
>::
VTKFunction
*
p
=
new
VTKGridFunctionWrapper
<
G
,
IS
,
RT
,
m
>
(
*
this
,
s
);
vtkwriter
.
addCellData
(
p
);
}
private
:
// a reference to the grid
const
G
&
grid_
;
...
...
This diff is collapsed.
Click to expand it.
disc/functions/p1function.hh
+
8
−
0
View file @
f59b1c41
...
...
@@ -26,6 +26,7 @@
#include
"dune/istl/bcrsmatrix.hh"
#include
"dune/istl/owneroverlapcopy.hh"
#include
"dune/disc/shapefunctions/lagrangeshapefunctions.hh"
#include
"dune/io/file/vtk/vtkwriter.hh"
// same directory includes
#include
"functions.hh"
...
...
@@ -929,6 +930,13 @@ namespace Dune
return
mapper_
;
}
//! VTK output
void
vtkout
(
VTKWriter
<
G
,
IS
>&
vtkwriter
,
std
::
string
s
)
{
typename
VTKWriter
<
G
,
IS
>::
VTKFunction
*
p
=
new
VTKGridFunctionWrapper
<
G
,
IS
,
RT
,
m
>
(
*
this
,
s
);
vtkwriter
.
addVertexData
(
p
);
}
private
:
// a reference to the grid
const
G
&
grid_
;
...
...
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