python+MSVC: reorganize headers to reduce req. includes

Signed-off-by: Thorsten Liebig <liebig@imst.de>
This commit is contained in:
Thorsten Liebig 2019-12-30 20:04:22 +01:00
parent fbfccc4110
commit e7475a3bd1
7 changed files with 68 additions and 20 deletions

View File

@ -188,7 +188,7 @@ set(SOURCES
openems.cpp
)
set(PUB_HEADERS openems.h)
set(PUB_HEADERS openems.h openems_global.h)
# libs
ADD_SUBDIRECTORY( tools )

View File

@ -55,7 +55,7 @@ else()
INSTALL(TARGETS nf2ff DESTINATION lib${LIB_SUFFIX})
endif()
INSTALL(FILES ${HEADERS} DESTINATION include/openEMS)
INSTALL(FILES nf2ff.h DESTINATION include/openEMS)
#TODO tarball, debug, release

View File

@ -133,6 +133,32 @@ void nf2ff::SetMirror(int type, int dir, float pos)
m_nf2ff.at(fn)->SetMirror(type, dir, pos);
}
double nf2ff::GetTotalRadPower(size_t f_idx) const
{
return m_nf2ff.at(f_idx)->GetTotalRadPower();
}
double nf2ff::GetMaxDirectivity(size_t f_idx) const
{
return m_nf2ff.at(f_idx)->GetMaxDirectivity();
}
complex<double>** nf2ff::GetETheta(size_t f_idx) const
{
return m_nf2ff.at(f_idx)->GetETheta();
}
complex<double>** nf2ff::GetEPhi(size_t f_idx) const
{
return m_nf2ff.at(f_idx)->GetEPhi();
}
double** nf2ff::GetRadPower(size_t f_idx) const
{
return m_nf2ff.at(f_idx)->GetRadPower();
}
bool nf2ff::AnalyseXMLNode(TiXmlElement* ti_nf2ff)
{
if (ti_nf2ff==NULL)

View File

@ -23,7 +23,6 @@
#include <vector>
#include <cmath>
#include <complex>
#include "nf2ff_calc.h"
using namespace std;
@ -39,6 +38,7 @@ using namespace std;
class TiXmlElement;
class nf2ff_calc;
class NF2FF_EXPORT nf2ff
{
@ -54,12 +54,12 @@ public:
void SetMirror(int type, int dir, float pos);
double GetTotalRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetTotalRadPower();}
double GetMaxDirectivity(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetMaxDirectivity();}
double GetTotalRadPower(size_t f_idx) const;
double GetMaxDirectivity(size_t f_idx) const;
complex<double>** GetETheta(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetETheta();}
complex<double>** GetEPhi(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetEPhi();}
double** GetRadPower(size_t f_idx) const {return m_nf2ff.at(f_idx)->GetRadPower();}
complex<double>** GetETheta(size_t f_idx) const;
complex<double>** GetEPhi(size_t f_idx) const;
double** GetRadPower(size_t f_idx) const;
//! Write results to a hdf5 file
bool Write2HDF5(string filename);

View File

@ -19,7 +19,7 @@
#define OPENEMS_H
#include <sstream>
#ifdef WIN32
#ifndef __GNUC__
#include <Winsock2.h> // for struct timeval
#else
#include <sys/time.h>
@ -27,7 +27,7 @@
#include <time.h>
#include <vector>
#include "tools/global.h"
#include "openems_global.h"
#define __OPENEMS_STAT_FILE__ "openEMS_stats.txt"
#define __OPENEMS_RUN_STAT_FILE__ "openEMS_run_stats.txt"

31
openems_global.h Normal file
View File

@ -0,0 +1,31 @@
/*
* Copyright (C) 2019 Thorsten Liebig (Thorsten.Liebig@gmx.de)
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef OPENEMS_GLOBAL_H
#define OPENEMS_GLOBAL_H
#if defined(WIN32)
#ifdef BUILD_OPENEMS_LIB
#define OPENEMS_EXPORT __declspec(dllexport)
#else
#define OPENEMS_EXPORT __declspec(dllimport)
#endif
#else
#define OPENEMS_EXPORT
#endif
#endif // OPENEMS_GLOBAL_H

View File

@ -21,16 +21,7 @@
#include <sstream>
#define _USE_MATH_DEFINES
#include "tools/array_ops.h"
#if defined(WIN32)
#ifdef BUILD_OPENEMS_LIB
#define OPENEMS_EXPORT __declspec(dllexport)
#else
#define OPENEMS_EXPORT __declspec(dllimport)
#endif
#else
#define OPENEMS_EXPORT
#endif
#include "openems_global.h"
// declare a parameter as unused
#define UNUSED(x) (void)(x);