Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
fmpi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
raphael.bach
fmpi
Commits
5f54ebce
Verified
Commit
5f54ebce
authored
3 years ago
by
raphael.bach
Browse files
Options
Downloads
Patches
Plain Diff
Add `fmpi_data` module
parent
1391a1f2
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/fmpi_data.h
+121
-0
121 additions, 0 deletions
include/fmpi_data.h
include/internal/generic/fmpi_data_generic.h
+48
-0
48 additions, 0 deletions
include/internal/generic/fmpi_data_generic.h
src/fmpi_data.c
+66
-0
66 additions, 0 deletions
src/fmpi_data.c
with
235 additions
and
0 deletions
include/fmpi_data.h
0 → 100644
+
121
−
0
View file @
5f54ebce
// SPDX-License-Identifier: 0BSD
/*!
* @file
* @license{
* BSD Zero Clause License
*
* Copyright (c) 2022 by Raphael Bach
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* }
*/
/*==============================================================================
GUARD
==============================================================================*/
#ifndef FMPI_DATA_H_20211228231216
#define FMPI_DATA_H_20211228231216
/*==============================================================================
INCLUDE
==============================================================================*/
// C Standard Library
#include
<stddef.h>
#include
<stdint.h>
// Internal
#include
"internal/generic/fmpi_data_generic.h"
#include
"internal/generic/fmpi_generic.h"
#include
"internal/generic/fmpi_type.h"
/*==============================================================================
TYPE
==============================================================================*/
/*------------------------------------------------------------------------------
fmpi_data
------------------------------------------------------------------------------*/
/**
* TODO
*
* @example{
* TODO
* }
*/
typedef
struct
fmpi_data
{
enum
fmpi_type
type
;
//!< TODO
size_t
dims_length
[
3
];
//!< TODO
size_t
dims_cnt
;
//!< TODO
void
*
start
;
//!< TODO
}
fmpi_data
;
/*==============================================================================
PUBLIC FUNCTION
==============================================================================*/
/*------------------------------------------------------------------------------
fmpi_data_1d()
------------------------------------------------------------------------------*/
/**
* TODO
*
* @param data : TODO
* @param x : TODO
*
* @expansion{
* TODO
* }
*
* @example{
* TODO
* }
*/
#define fmpi_data_1d(data, x) \
FMPI_GENERIC_FUNC(data, data_1d, FMPI_DATA_TYPES)(data, x, 0, 0)
/*------------------------------------------------------------------------------
fmpi_data_2d()
------------------------------------------------------------------------------*/
/**
* TODO
*
* @param data : TODO
* @param x : TODO
* @param y : TODO
*
* @expansion{
* TODO
* }
*
* @example{
* TODO
* }
*/
#define fmpi_data_2d(data, x, y) \
FMPI_GENERIC_FUNC(data, data_2d, FMPI_DATA_TYPES)(data, x, y, 0)
/*------------------------------------------------------------------------------
fmpi_data_3d()
------------------------------------------------------------------------------*/
/**
* TODO
*
* @param data : TODO
* @param x : TODO
* @param y : TODO
* @param z : TODO
*
* @expansion{
* TODO
* }
*
* @example{
* TODO
* }
*/
#define fmpi_data_3d(data, x, y, z) \
FMPI_GENERIC_FUNC(data, data_3d, FMPI_DATA_TYPES)(data, x, y, z)
/*==============================================================================
GUARD
==============================================================================*/
#endif // FMPI_DATA_H_20211228231216
This diff is collapsed.
Click to expand it.
include/internal/generic/fmpi_data_generic.h
0 → 100644
+
48
−
0
View file @
5f54ebce
// SPDX-License-Identifier: 0BSD
/*!
* @file
* @license{
* BSD Zero Clause License
*
* Copyright (c) 2022 by Raphael Bach
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* }
*/
/*==============================================================================
GUARD
==============================================================================*/
#ifndef FMPI_DATA_INTERNAL_H_20211231184018
#define FMPI_DATA_INTERNAL_H_20211231184018
/*==============================================================================
INCLUDE
==============================================================================*/
// C Standard Library
#include
<stddef.h>
// size_t
// Internal
#include
"fmpi_generic.h"
/*==============================================================================
MACRO
==============================================================================*/
#define FMPI_DATA_TYPES \
FMPI_TYPE_REAL
#define FMPI_DATA_DECLARATION(D, T) \
struct fmpi_data fmpi_data_##D##d_##T(T * data, size_t x, size_t y, size_t z)
FMPI_DECLARE_DIM_FUNCS
(
FMPI_DATA_DECLARATION
,
1
,
FMPI_DATA_TYPES
);
FMPI_DECLARE_DIM_FUNCS
(
FMPI_DATA_DECLARATION
,
2
,
FMPI_DATA_TYPES
);
FMPI_DECLARE_DIM_FUNCS
(
FMPI_DATA_DECLARATION
,
3
,
FMPI_DATA_TYPES
);
/*==============================================================================
GUARD
==============================================================================*/
#endif // FMPI_DATA_INTERNAL_H_20211231184018
This diff is collapsed.
Click to expand it.
src/fmpi_data.c
0 → 100644
+
66
−
0
View file @
5f54ebce
// SPDX-License-Identifier: 0BSD
/*!
* @file
* @license{
* BSD Zero Clause License
*
* Copyright (c) 2022 by Raphael Bach
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
* }
*/
/*==============================================================================
INCLUDE
==============================================================================*/
// Own header
#include
"fmpi_data.h"
// C Standard Library
#include
<assert.h>
#include
<stddef.h>
// NULL, size_t
// Internal
#include
"internal/generic/fmpi_type.h"
/*==============================================================================
PRIVATE FUNCTION DECLARATION
==============================================================================*/
static
struct
fmpi_data
fmpi_data_create
(
void
*
data
,
enum
fmpi_type
type
,
size_t
dims_cnt
,
size_t
x
,
size_t
y
,
size_t
z
);
/*==============================================================================
PUBLIC FUNCTION DEFINITION
==============================================================================*/
#define FMPI_DATA_DEFINITION(D, T) \
struct fmpi_data fmpi_data_##D##d_##T( \
T * const data, const size_t x, const size_t y, const size_t z \
){ \
assert(data != NULL); \
return fmpi_data_create(data, FMPI_TYPE_##T, D, x, y, z); \
}
FMPI_DEFINE_DIM_FUNCS
(
FMPI_DATA_DEFINITION
,
1
,
FMPI_DATA_TYPES
)
FMPI_DEFINE_DIM_FUNCS
(
FMPI_DATA_DEFINITION
,
2
,
FMPI_DATA_TYPES
)
FMPI_DEFINE_DIM_FUNCS
(
FMPI_DATA_DEFINITION
,
3
,
FMPI_DATA_TYPES
)
/*==============================================================================
PRIVATE FUNCTION DEFINITION
==============================================================================*/
static
struct
fmpi_data
fmpi_data_create
(
void
*
const
data
,
const
enum
fmpi_type
type
,
const
size_t
dims_cnt
,
const
size_t
x
,
const
size_t
y
,
const
size_t
z
){
assert
(
data
!=
NULL
);
assert
(
dims_cnt
>=
0
&&
dims_cnt
<=
3
);
return
(
struct
fmpi_data
){
.
type
=
type
,
.
dims_length
=
{
x
,
y
,
z
},
.
dims_cnt
=
dims_cnt
,
.
start
=
data
};
}
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