Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SWIFTsim
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Model registry
Monitor
Incidents
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
Show more breadcrumbs
SWIFT
SWIFTsim
Commits
e1367e66
Commit
e1367e66
authored
6 years ago
by
Loic Hausammann
Browse files
Options
Downloads
Patches
Plain Diff
Remove the index files
parent
d60eea31
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!685
Logger loader
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
logger/logger_index.c
+0
-84
0 additions, 84 deletions
logger/logger_index.c
logger/logger_index.h
+0
-74
0 additions, 74 deletions
logger/logger_index.h
logger/tests/Makefile.am
+2
-3
2 additions, 3 deletions
logger/tests/Makefile.am
with
2 additions
and
161 deletions
logger/logger_index.c
deleted
100644 → 0
+
0
−
84
View file @
d60eea31
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
/* Config parameters. */
#include
"../config.h"
/* Some standard headers. */
#include
<stdio.h>
/* This object's header. */
#include
"logger_index.h"
#include
"logger_loader_io.h"
#include
"logger_tools.h"
/**
* @brief Initialize the #logger_index by reading the index file.
*
* @param index The #logger_index.
* @param reader The #logger_reader.
* @param filename The filename.
*/
void
logger_index_init
(
struct
logger_index
*
index
,
struct
logger_reader
*
reader
,
char
*
filename
)
{
/* Open file. */
index
->
data
=
logger_loader_io_mmap_file
(
filename
,
&
index
->
file_size
,
/* read_only */
1
);
/* Read the double time. */
size_t
offset
=
0
;
void
*
map
=
index
->
data
+
offset
;
map
=
logger_loader_io_read_data
(
map
,
sizeof
(
double
),
&
index
->
time
);
/* Read the integer time. */
map
=
logger_loader_io_read_data
(
map
,
sizeof
(
integertime_t
),
&
index
->
int_time
);
/* Read the number of particles. */
map
=
logger_loader_io_read_data
(
map
,
swift_type_count
*
sizeof
(
long
long
),
&
index
->
number_particles
);
/* Count total number of particles. */
long
long
N
=
0
;
for
(
int
j
=
0
;
j
<
swift_type_count
;
j
++
)
{
N
+=
index
->
number_particles
[
j
];
}
index
->
total_number_particles
=
N
;
}
/**
* @brief Free the memory.
*
* @param index The #logger_index.
*/
void
logger_index_free
(
struct
logger_index
*
index
)
{
/* unmap file. */
logger_loader_io_munmap_file
(
index
->
data
,
index
->
file_size
);
/* Set variables to default value. */
index
->
total_number_particles
=
0
;
for
(
int
i
=
0
;
i
<
swift_type_count
;
i
++
)
{
index
->
number_particles
[
i
]
=
0
;
}
}
This diff is collapsed.
Click to expand it.
logger/logger_index.h
deleted
100644 → 0
+
0
−
74
View file @
d60eea31
/*******************************************************************************
* This file is part of SWIFT.
* Copyright (c) 2019 Loic Hausammann (loic.hausammann@epfl.ch)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
******************************************************************************/
#include
"logger_tools.h"
/**
* @file logger_index.h
* @brief This file deals with the index files.
*/
#ifndef __LOGGER_LOGGER_INDEX_H__
#define __LOGGER_LOGGER_INDEX_H__
struct
logger_reader
;
struct
logger_index_data
{
/* The particle's id. */
uint64_t
id
;
/* The particle's offset. */
uint64_t
offset
;
};
/**
* @brief This structure contains the data related to
* an index file.
*
* It is initialized with #logger_index_init and freed with
* #logger_index_free.
*/
struct
logger_index
{
/* The reader. */
struct
logger_reader
*
reader
;
/* memory map of the index file. */
void
*
data
;
/* Index file size. */
size_t
file_size
;
/* Number of particles. */
size_t
total_number_particles
;
/* Number of particles per type. */
long
long
number_particles
[
swift_type_count
];
/* Time of the index file. */
double
time
;
/* Integer time of the index file. */
integertime_t
int_time
;
};
void
logger_index_init
(
struct
logger_index
*
index
,
struct
logger_reader
*
reader
,
char
*
filename
);
void
logger_index_free
(
struct
logger_index
*
index
);
#endif // __LOGGER_LOGGER_INDEX_H__
This diff is collapsed.
Click to expand it.
logger/tests/Makefile.am
+
2
−
3
View file @
e1367e66
...
@@ -20,7 +20,7 @@ AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/logger $(HDF5_CPPFLAGS) $(GSL_IN
...
@@ -20,7 +20,7 @@ AM_CFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/logger $(HDF5_CPPFLAGS) $(GSL_IN
AM_LDFLAGS
=
../../src/.libs/libswiftsim.a ../.libs/liblogger.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
TBBMALLOC_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
$(
PROFILER_LIBS
)
AM_LDFLAGS
=
../../src/.libs/libswiftsim.a ../.libs/liblogger.a
$(
HDF5_LDFLAGS
)
$(
HDF5_LIBS
)
$(
FFTW_LIBS
)
$(
TCMALLOC_LIBS
)
$(
JEMALLOC_LIBS
)
$(
TBBMALLOC_LIBS
)
$(
GRACKLE_LIBS
)
$(
GSL_LIBS
)
$(
PROFILER_LIBS
)
# List of programs and scripts to run in the test suite
# List of programs and scripts to run in the test suite
TESTS
=
testLogfileHeader testLogfileReader
# testIndex
TESTS
=
testLogfileHeader testLogfileReader
# List of test programs to compile
# List of test programs to compile
check_PROGRAMS
=
testLogfileHeader testLogfileReader
check_PROGRAMS
=
testLogfileHeader testLogfileReader
...
@@ -31,7 +31,6 @@ $(check_PROGRAMS): ../../src/.libs/libswiftsim.a
...
@@ -31,7 +31,6 @@ $(check_PROGRAMS): ../../src/.libs/libswiftsim.a
# Sources for the individual programs
# Sources for the individual programs
testLogfileHeader_SOURCES
=
testLogfileHeader.c
testLogfileHeader_SOURCES
=
testLogfileHeader.c
testLogfileReader_SOURCES
=
testLogfileReader.c
testLogfileReader_SOURCES
=
testLogfileReader.c
# testIndex_SOURCES = testIndex.c
# Files necessary for distribution
# Files necessary for distribution
EXTRA_DIST
=
testLogfileHeader.yml testLogfileReader.yml
testIndex.yml
EXTRA_DIST
=
testLogfileHeader.yml testLogfileReader.yml
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