Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Bing Yuan
Nektar
Commits
c094be96
Commit
c094be96
authored
Apr 10, 2017
by
David Moxey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change documentation for NekFactory and fix warning arising from CommDataType
parent
4c4048c9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
43 deletions
+69
-43
library/LibUtilities/BasicUtils/NekFactory.hpp
library/LibUtilities/BasicUtils/NekFactory.hpp
+13
-15
library/LibUtilities/Communication/CommDataType.cpp
library/LibUtilities/Communication/CommDataType.cpp
+54
-22
library/LibUtilities/Communication/CommDataType.h
library/LibUtilities/Communication/CommDataType.h
+2
-6
No files found.
library/LibUtilities/BasicUtils/NekFactory.hpp
View file @
c094be96
...
...
@@ -59,36 +59,34 @@ typedef boost::shared_lock<boost::shared_mutex> ReadLock;
/**
* @class NekFactory
\brief Provides a generic Factory class.
*
* Implements a generic object factory. Class-types which use a
* potentially arbitrary number of parameters may be used with
* specialised forms of the NekFactory. An upper
* limit on the number of parameters is imposed by the MAX_PARAM
* preprocessor definition in the NekFactory.hpp file. The
* specialisations are generated at compile type using Boost
* preprocessor by through repeated inclusion of the NekFactory.hpp
* file.
* @brief Provides a generic Factory class.
*
* Implements a generic object factory. Class-types which use an arbitrary
* number of parameters may be used via C++ variadic templating.
*
* To allow a class to be instantiated by the factory, the following are
* required in each class definition (in the case of a single parameter):
*
* To allow a class to be instantiated by the factory, the
* following are required in each class definition (in the case of
* a single parameter):
* \code
* static [baseclass]* create([paramtype1] &P) {
* return new [derivedclass](P);
* }
* static std::string className;
* \endcode
*
* and outside the class definition in the implementation:
*
* \code
* std::string [derivedclass]::className
* = Factory<std::string,[baseclass],[paramtype1]>::
* RegisterCreatorFunction("[derivedclass]",
* [derivedclass]::create,"Description");
* \endcode
* The assignment of the static variable className is done through the
* call to RegisterCreatorFunction, which registers the class with the
* factory prior to the start of the main() routine.
*
* The assignment of the static variable className is done through the call to
* RegisterCreatorFunction, which registers the class with the factory prior to
* the start of the main() routine.
*
* To create an instance of a derived class, for instance:
* \code
...
...
library/LibUtilities/Communication/CommDataType.cpp
View file @
c094be96
...
...
@@ -82,27 +82,59 @@ int CommDataTypeGetSize(CommDataType dt)
#endif
}
/// Type trait mapping an int to MPI_INT
template
<
>
CommDataType
CommDataTypeTraits
<
int
>::
type
=
MPI_INT
;
/// Type trait mapping an unsigned int to MPI_UNSIGNED
template
<
>
CommDataType
CommDataTypeTraits
<
unsigned
>::
type
=
MPI_UNSIGNED
;
/// Type trait mapping a long int to MPI_LONG
template
<
>
CommDataType
CommDataTypeTraits
<
long
>::
type
=
MPI_LONG
;
/// Type trait mapping an unsigned long int to MPI_UNSIGNED_LONG
template
<
>
CommDataType
CommDataTypeTraits
<
unsigned
long
>::
type
=
MPI_UNSIGNED_LONG
;
/// Type trait mapping a long long int to MPI_LONG_LONG
template
<
>
CommDataType
CommDataTypeTraits
<
long
long
>::
type
=
MPI_LONG_LONG
;
/// Type trait mapping an unsigned long long int to MPI_UNSIGNED_LONG_LONG
template
<
>
CommDataType
CommDataTypeTraits
<
unsigned
long
long
>::
type
=
MPI_UNSIGNED_LONG_LONG
;
/// Type trait mapping a float to MPI_FLOAT
template
<
>
CommDataType
CommDataTypeTraits
<
float
>::
type
=
MPI_FLOAT
;
/// Type trait mapping a double to MPI_DOUBLE
template
<
>
CommDataType
CommDataTypeTraits
<
double
>::
type
=
MPI_DOUBLE
;
/// Type trait mapping a long double to MPI_LONG_DOUBLE
template
<
>
CommDataType
CommDataTypeTraits
<
long
double
>::
type
=
MPI_LONG_DOUBLE
;
template
<
>
CommDataType
&
CommDataTypeTraits
<
int
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_INT
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
unsigned
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_UNSIGNED
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
long
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_LONG
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
unsigned
long
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_UNSIGNED_LONG
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
long
long
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_LONG_LONG
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
unsigned
long
long
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_UNSIGNED_LONG_LONG
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
float
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_FLOAT
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
double
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_DOUBLE
;
return
type
;
}
template
<
>
CommDataType
&
CommDataTypeTraits
<
long
double
>::
GetDataType
()
{
static
CommDataType
type
=
MPI_LONG_DOUBLE
;
return
type
;
}
}
}
library/LibUtilities/Communication/CommDataType.h
View file @
c094be96
...
...
@@ -82,13 +82,9 @@ int CommDataTypeGetSize(CommDataType);
template
<
class
T
>
class
CommDataTypeTraits
{
LIB_UTILITIES_EXPORT
static
CommDataType
type
;
public:
static
CommDataType
&
GetDataType
()
{
return
type
;
}
LIB_UTILITIES_EXPORT
static
CommDataType
&
GetDataType
();
static
void
*
GetPointer
(
T
&
val
)
{
return
&
val
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment