Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NP_TMcode
Manage
Activity
Members
Plan
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Giacomo Mulas
NP_TMcode
Commits
750bb121
Commit
750bb121
authored
4 months ago
by
Giovanni La Mura
Browse files
Options
Downloads
Patches
Plain Diff
Create inclusion case program handler
parent
462c491f
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/inclusion/np_inclusion.cpp
+89
-0
89 additions, 0 deletions
src/inclusion/np_inclusion.cpp
with
89 additions
and
0 deletions
src/inclusion/np_inclusion.cpp
0 → 100644
+
89
−
0
View file @
750bb121
/* Copyright (C) 2024 INAF - Osservatorio Astronomico di Cagliari
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU 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.
A copy of the GNU General Public License is distributed along with
this program in the COPYING file. If not, see: <https://www.gnu.org/licenses/>.
*/
/*! \file np_inclusion.cpp
*
* \brief Sphere with inclusions scattering program handler.
*
* This program emulates the execution work-flow originally handled by the
* FORTRAN EDFB_INCLU and INCLU codes, which undertook the task of solving the
* scattering calculation for the case of a sphere with inclusions. The program
* is designed to work in two modes: emulation and enhanced. The emulation mode
* is activated by invoking the program without arguments. In this case, the
* code looks for hard-coded default input and writes output in the execution
* folder, replicating the behaviour of the original FORTRAN code. Enhanced
* mode, instead, is activated by passing command line arguments that locate
* the desired input files and a valid folder to write the output into. The
* emulation mode is useful for testing, while the advanced mode implements
* the possibility to change input and output options, without having to modify
* the code.
*/
#include
<cstdio>
#include
<string>
#ifndef INCLUDE_TYPES_H_
#include
"../include/types.h"
#endif
#ifndef INCLUDE_CONFIGURATION_H_
#include
"../include/Configuration.h"
#endif
#ifndef INCLUDE_COMMONS_H_
#include
"../include/Commons.h"
#endif
using
namespace
std
;
extern
void
inclusion
(
const
string
&
config_file
,
const
string
&
data_file
,
const
string
&
output_path
,
const
mixMPI
&
mpidata
);
/*! \brief Main program entry point.
*
* This is the starting point of the execution flow. Here we may choose
* how to configure the code, e.g. by loading a legacy configuration file
* or some otherwise formatted configuration data set. The code can be
* linked to a luncher script or to a GUI oriented application that performs
* the configuration and runs the main program.
*
* \param argc: `int` The number of arguments given in command-line.
* \param argv: `char **` The vector of command-line arguments.
* \return result: `int` An exit code passed to the OS (0 for succesful execution).
*/
int
main
(
int
argc
,
char
**
argv
)
{
#ifdef MPI_VERSION
int
ierr
=
MPI_Init
(
&
argc
,
&
argv
);
// create and initialise class with essential MPI data
mixMPI
*
mpidata
=
new
mixMPI
(
MPI_COMM_WORLD
);
#else
// create a the class with dummy data if we are not using MPI at all
mixMPI
*
mpidata
=
new
mixMPI
();
#endif
string
config_file
=
"../../test_data/inclusion/DEDFB"
;
string
data_file
=
"../../test_data/inclusion/DINCLU"
;
string
output_path
=
"."
;
if
(
argc
==
4
)
{
config_file
=
string
(
argv
[
1
]);
data_file
=
string
(
argv
[
2
]);
output_path
=
string
(
argv
[
3
]);
}
inclusion
(
config_file
,
data_file
,
output_path
,
mpidata
);
#ifdef MPI_VERSION
MPI_Finalize
();
#endif
delete
mpidata
;
return
0
;
}
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