Skip to content

Commit

Permalink
Merge pull request i-RIC#70 from kskinoue0612/issue-69
Browse files Browse the repository at this point in the history
Closes i-RIC#69
  • Loading branch information
scharlton2 authored Dec 9, 2019
2 parents fc13dbf + 91f6db5 commit 397707b
Show file tree
Hide file tree
Showing 15 changed files with 449 additions and 4 deletions.
78 changes: 78 additions & 0 deletions iric_ftoc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1229,6 +1229,45 @@ void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_integer_mul_f, CG_IRIC_WRITE_S
*ier = cg_iRIC_Write_Sol_Particle_Integer_Mul(*fid, c_name, value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_groupbegin_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_GROUPBEGIN_MUL_F) (int *fid, STR_PSTR(name), int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_GroupBegin_Mul(*fid, c_name);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_groupend_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_GROUPEND_MUL_F) (int *fid, int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_GroupEnd_Mul(*fid);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_pos2d_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_POS2D_MUL_F) (int *fid, double *x, double *y, int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_Pos2d_Mul(*fid, *x, *y);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_pos3d_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_POS3D_MUL_F) (int *fid, double *x, double *y, double *z, int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_Pos3d_Mul(*fid, *x, *y, *z);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_integer_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_INTEGER_MUL_F) (int *fid, STR_PSTR(name), int *value, int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_Integer_Mul(*fid, c_name, *value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_real_mul_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_REAL_MUL_F) (int *fid, STR_PSTR(name), double *value, int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_Real_Mul(*fid, c_name, *value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_polydata_groupbegin_mul_f, CG_IRIC_WRITE_SOL_POLYDATA_GROUPBEGIN_MUL_F) (int *fid, STR_PSTR(name), int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
Expand Down Expand Up @@ -2489,6 +2528,45 @@ void IRICLIBDLL FMNAME(cg_iric_write_sol_particle_integer_f, CG_IRIC_WRITE_SOL_P
*ier = cg_iRIC_Write_Sol_Particle_Integer(c_name, value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_groupbegin_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_GROUPBEGIN_F) (STR_PSTR(name), int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(c_name);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_groupend_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_GROUPEND_F) (int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_GroupEnd();
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_pos2d_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_POS2D_F) (double *x, double *y, int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_Pos2d(*x, *y);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_pos3d_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_POS3D_F) (double *x, double *y, double *z, int *ier) {
*ier = cg_iRIC_Write_Sol_ParticleGroup_Pos3d(*x, *y, *z);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_integer_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_INTEGER_F) (STR_PSTR(name), int *value, int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_Integer(c_name, *value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_particlegroup_real_f, CG_IRIC_WRITE_SOL_PARTICLEGROUP_REAL_F) (STR_PSTR(name), double *value, int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
c_name, CGIO_MAX_NAME_LENGTH, ier);
if (*ier) return;

*ier = cg_iRIC_Write_Sol_ParticleGroup_Real(c_name, *value);
}

void IRICLIBDLL FMNAME(cg_iric_write_sol_polydata_groupbegin_f, CG_IRIC_WRITE_SOL_POLYDATA_GROUPBEGIN_F) (STR_PSTR(name), int *ier STR_PLEN(name)) {
char c_name[CGIO_MAX_NAME_LENGTH+1];
string_2_C_string(STR_PTR(name), STR_LEN(name),
Expand Down
36 changes: 36 additions & 0 deletions iriclib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1050,6 +1050,42 @@ int cg_iRIC_Write_Sol_Particle_Integer_Mul(int fid, const char* name, int* value
return f->Sol_Particle_Write_Integer(name, value);
}

int cg_iRIC_Write_Sol_ParticleGroup_GroupBegin_Mul(int fid, const char* name)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_GroupBegin(name);
}

int cg_iRIC_Write_Sol_ParticleGroup_GroupEnd_Mul(int fid)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_GroupEnd();
}

int cg_iRIC_Write_Sol_ParticleGroup_Pos2d_Mul(int fid, double x, double y)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_Pos2d(x, y);
}

int cg_iRIC_Write_Sol_ParticleGroup_Pos3d_Mul(int fid, double x, double y, double z)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_Pos3d(x, y, z);
}

int cg_iRIC_Write_Sol_ParticleGroup_Integer_Mul(int fid, const char* name, int value)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_Integer(name, value);
}

int cg_iRIC_Write_Sol_ParticleGroup_Real_Mul(int fid, const char* name, double value)
{
GET_F(fid);
return f->Sol_ParticleGroup_Write_Real(name, value);
}

int cg_iRIC_Write_Sol_PolyData_GroupBegin_Mul(int fid, const char* name)
{
GET_F(fid);
Expand Down
23 changes: 23 additions & 0 deletions iriclib.h
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,17 @@ int IRICLIBDLL cg_iRIC_Write_Sol_Particle_Pos3d_Mul(int fid, cgsize_t count, dou
int IRICLIBDLL cg_iRIC_Write_Sol_Particle_Real_Mul(int fid, const char* name, double* value);
int IRICLIBDLL cg_iRIC_Write_Sol_Particle_Integer_Mul(int fid, const char* name, int* value);

/**********************************************/
/* Writing Particle Groups */
/**********************************************/

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_GroupBegin_Mul(int fid, const char* name);
int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_GroupEnd_Mul(int fid);
int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Pos2d_Mul(int fid, double x, double y);
int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Pos3d_Mul(int fid, double x, double y, double z);
int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Integer_Mul(int fid, const char* name, int value);
int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Real_Mul(int fid, const char* name, double value);

/**********************************************/
/* Writing Polydata */
/**********************************************/
Expand Down Expand Up @@ -680,6 +691,18 @@ int IRICLIBDLL cg_iRIC_Write_Sol_Particle_Real(const char* name, double* value);

int IRICLIBDLL cg_iRIC_Write_Sol_Particle_Integer(const char* name, int* value);

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(const char* name);

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_GroupEnd();

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Pos2d(double x, double y);

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Pos3d(double x, double y, double z);

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Integer(const char* name, int value);

int IRICLIBDLL cg_iRIC_Write_Sol_ParticleGroup_Real(const char* name, double value);

int IRICLIBDLL cg_iRIC_Write_Sol_PolyData_GroupBegin(const char* name);

int IRICLIBDLL cg_iRIC_Write_Sol_PolyData_GroupEnd();
Expand Down
11 changes: 11 additions & 0 deletions iriclib_cgnsfile.h
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,17 @@ class CgnsFile
int Sol_Particle_Write_Real(const char* name, double* value);
int Sol_Particle_Write_Integer(const char* name, int* value);

// ----------------------------
// Solution Particle Group I/O
// ----------------------------

int Sol_ParticleGroup_Write_GroupBegin(const char* name);
int Sol_ParticleGroup_Write_GroupEnd();
int Sol_ParticleGroup_Write_Pos2d(double x, double y);
int Sol_ParticleGroup_Write_Pos3d(double x, double y, double z);
int Sol_ParticleGroup_Write_Integer(const char* name, int value);
int Sol_ParticleGroup_Write_Real(const char* name, double value);

// ----------------------
// Solution Polydata I/O
// ----------------------
Expand Down
18 changes: 18 additions & 0 deletions iriclib_cgnsfile_base.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,11 @@ void CgnsFile::Impl::getParticleSolName(int num, char* name)
sprintf(name, "ParticleSolution%d", num);
}

void CgnsFile::Impl::getParticleGroupSolName(int num, char* name)
{
sprintf(name, "ParticleGroupSolution%d", num);
}

void CgnsFile::Impl::getPolydataSolName(int num, char* name)
{
sprintf(name, "PolydataSolution%d", num);
Expand Down Expand Up @@ -758,6 +763,9 @@ int CgnsFile::Impl::addSolutionNode(int fid, int bid, int zid, int sid, std::vec
ier = writeFlowJFaceSolutionPointers(fid, bid, zid, *jfacesols);
RETURN_IF_ERR;

ier = addParticleGroupSolutionNode(fid, bid, zid, sid);
RETURN_IF_ERR;

ier = addPolydataSolutionNode(fid, bid, zid, sid);
RETURN_IF_ERR;

Expand Down Expand Up @@ -789,6 +797,16 @@ int CgnsFile::Impl::addParticleSolutionNode(int fid, int bid, int zid, int sid)
return cg_user_data_write(solname);
}

int CgnsFile::Impl::addParticleGroupSolutionNode(int fid, int bid, int zid, int sid)
{
char solname[NAME_MAXLENGTH];
getParticleGroupSolName(sid, solname);

int ier = cg_goto(fid, bid, "Zone_t", zid, NULL);
RETURN_IF_ERR;
return cg_user_data_write(solname);
}

int CgnsFile::Impl::addPolydataSolutionNode(int fid, int bid, int zid, int sid)
{
char solname[NAME_MAXLENGTH];
Expand Down
30 changes: 30 additions & 0 deletions iriclib_cgnsfile_sol.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,36 @@ int CgnsFile::Sol_Particle_Write_Integer(const char* name, int* value)
return impl->m_solutionWriter->Sol_Particle_Write_Integer(name, value);
}

int CgnsFile::Sol_ParticleGroup_Write_GroupBegin(const char* name)
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_GroupBegin(name);
}

int CgnsFile::Sol_ParticleGroup_Write_GroupEnd()
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_GroupEnd();
}

int CgnsFile::Sol_ParticleGroup_Write_Pos2d(double x, double y)
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_Pos2d(x, y);
}

int CgnsFile::Sol_ParticleGroup_Write_Pos3d(double x, double y, double z)
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_Pos3d(x, y, z);
}

int CgnsFile::Sol_ParticleGroup_Write_Integer(const char* name, int value)
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_Integer(name, value);
}

int CgnsFile::Sol_ParticleGroup_Write_Real(const char* name, double value)
{
return impl->m_solutionWriter->Sol_ParticleGroup_Write_Real(name, value);
}

int CgnsFile::Sol_PolyData_Write_GroupBegin(const char* name)
{
return impl->m_solutionWriter->Sol_PolyData_Write_GroupBegin(name);
Expand Down
30 changes: 30 additions & 0 deletions iriclib_single.c
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,36 @@ int cg_iRIC_Write_Sol_Particle_Integer(const char* name, int* value)
return cg_iRIC_Write_Sol_Particle_Integer_Mul(lastfileid, name, value);
}

int cg_iRIC_Write_Sol_ParticleGroup_GroupBegin(const char* name)
{
return cg_iRIC_Write_Sol_ParticleGroup_GroupBegin_Mul(lastfileid, name);
}

int cg_iRIC_Write_Sol_ParticleGroup_GroupEnd()
{
return cg_iRIC_Write_Sol_ParticleGroup_GroupEnd_Mul(lastfileid);
}

int cg_iRIC_Write_Sol_ParticleGroup_Pos2d(double x, double y)
{
return cg_iRIC_Write_Sol_ParticleGroup_Pos2d_Mul(lastfileid, x, y);
}

int cg_iRIC_Write_Sol_ParticleGroup_Pos3d(double x, double y, double z)
{
return cg_iRIC_Write_Sol_ParticleGroup_Pos3d_Mul(lastfileid, x, y, z);
}

int cg_iRIC_Write_Sol_ParticleGroup_Integer(const char* name, int value)
{
return cg_iRIC_Write_Sol_ParticleGroup_Integer_Mul(lastfileid, name, value);
}

int cg_iRIC_Write_Sol_ParticleGroup_Real(const char* name, double value)
{
return cg_iRIC_Write_Sol_ParticleGroup_Real_Mul(lastfileid, name, value);
}

int cg_iRIC_Write_Sol_PolyData_GroupBegin(const char* name)
{
return cg_iRIC_Write_Sol_PolyData_GroupBegin_Mul(lastfileid, name);
Expand Down
7 changes: 5 additions & 2 deletions private/iriclib_cgnsfile_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,23 @@ class CgnsFile::Impl

static void getSolGridCoordName(int num, char* name);
static void getParticleSolName(int num, char* name);
static void getParticleGroupSolName(int num, char* name);
static void getPolydataSolName(int num, char* name);

static int addSolutionNode(int fid, int bid, int zid, int sid, std::vector<std::string>* sols, std::vector<std::string>* cellsols, std::vector<std::string>* ifacesols, std::vector<std::string>* jfacesols);
static int addSolutionGridCoordNode(int fid, int bid, int zid, int sid, std::vector<std::string>* coords);
static int addParticleSolutionNode(int fid, int bid, int zid, int sid);
static int addParticleGroupSolutionNode(int fid, int bid, int zid, int sid);
static int addPolydataSolutionNode(int fid, int bid, int zid, int sid);

static int writePointers(int fid, int bid, int zid, const char* name, const std::vector<std::string>& strs);
static int writeFlowSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writeFlowCellSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writeFlowIFaceSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writeFlowJFaceSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);

static int writeParticleSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writeParticleGroupSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writePolydataSolutionPointers(int fid, int bid, int zid, const std::vector<std::string>& sols);
static int writeGridCoordinatesPointers(int fid, int bid, int zid, const std::vector<std::string>& coords);

int solIndex(CGNS_ENUMT(GridLocation_t) location, int step);
Expand Down Expand Up @@ -138,7 +142,6 @@ class CgnsFile::Impl
std::vector<std::string> m_cellSolPointers;
std::vector<std::string> m_ifaceSolPointers;
std::vector<std::string> m_jfaceSolPointers;
std::vector<std::string> m_solParticlePointers;

std::vector<BaseIterativeT<int> > m_solBaseIterInts;
std::vector<BaseIterativeT<double> > m_solBaseIterReals;
Expand Down
Loading

0 comments on commit 397707b

Please sign in to comment.