Add H5Fed.
This commit is contained in:
@@ -3,6 +3,31 @@
|
||||
/COPYRIGHT -text
|
||||
/ChangeLog -text
|
||||
/GNUmakefile.orig -text
|
||||
H5Fed/applications/gmsh2h5fed.cc -text
|
||||
H5Fed/applications/gmsh2h5fed.hh -text
|
||||
H5Fed/applications/makefile.am -text
|
||||
H5Fed/autogen.sh -text
|
||||
H5Fed/configure.ac -text
|
||||
H5Fed/grids/cube0.geo -text
|
||||
H5Fed/grids/cube0.msh -text
|
||||
H5Fed/grids/cubeincube.geo -text
|
||||
H5Fed/grids/cubeincube.msh -text
|
||||
H5Fed/grids/sphere.geo -text
|
||||
H5Fed/grids/sphere.msh -text
|
||||
H5Fed/libsrc/gmsh/gmsh.cc -text
|
||||
H5Fed/libsrc/gmsh/gmsh.hh -text
|
||||
H5Fed/libsrc/gmsh/gmshconst.hh -text
|
||||
H5Fed/libsrc/gmsh/gmshgrammar.hh -text
|
||||
H5Fed/libsrc/gmsh/gmshsemanticaction.hh -text
|
||||
H5Fed/libsrc/gmsh/makefile.am -text
|
||||
H5Fed/libsrc/h5fed/h5fed.cc -text
|
||||
H5Fed/libsrc/h5fed/h5fed.hh -text
|
||||
H5Fed/libsrc/h5fed/h5fedconst.hh -text
|
||||
H5Fed/libsrc/h5fed/makefile.am -text
|
||||
H5Fed/libsrc/makefile.am -text
|
||||
H5Fed/libsrc/stdincl/nonsciconst.h -text
|
||||
H5Fed/libsrc/stdincl/physicomath.h -text
|
||||
H5Fed/makefile.am -text
|
||||
/Makefile.am -text
|
||||
/Makefile.orig -text
|
||||
/NEWS -text
|
||||
|
||||
@@ -0,0 +1,427 @@
|
||||
// rights - 2006-, copyright patrick leidenberger and benedikt oswald,
|
||||
// all rights reserved
|
||||
// project - gmsh2h5fed
|
||||
// file name - gmsh2h5fed.cc
|
||||
// file type - c++ implementaton file
|
||||
// objective - main file for the gmsh to hdf5fed converter
|
||||
// modified - 2006 jun 26, creation, patrick leidenberger
|
||||
// modified - 2006 aug 25, extend, patrick leidenberger
|
||||
// modified - 2006 aug 26, pl, integrate automatic index mapping.
|
||||
//
|
||||
// feature - Implements the a mesh preprocessor.
|
||||
// feature - It will read gmsh's mesh files of version 2.0 and write the mesh
|
||||
// feature - into an HDF5/FiniteElementData file.
|
||||
// required software - rlog library, boost library
|
||||
|
||||
#include <gmsh2h5fed.hh>
|
||||
|
||||
using namespace rlog;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
//=================//
|
||||
// Initialize RLog //
|
||||
//=================//
|
||||
// Make a instance of the class for RLog.
|
||||
StdioNode stdLog;
|
||||
|
||||
/** Subscchar* inFile_;ribe output channels.
|
||||
* Compile with -DRLOG_DEBUG to get the debug output.
|
||||
**/
|
||||
#ifdef USE_RLOG_DEBUG_CHANNEL
|
||||
stdLog.subscribeTo(GetGlobalChannel("debug"));
|
||||
#endif //USE_RLOG_DEBUG_CHANNEL
|
||||
#ifdef USE_RLOG_ERROR_CHANNEL
|
||||
stdLog.subscribeTo(GetGlobalChannel("error"));
|
||||
#endif //USE_RLOG_ERROR_CHANNEL
|
||||
#ifdef USE_RLOG_INFO_CHANNEL
|
||||
stdLog.subscribeTo(GetGlobalChannel("info"));
|
||||
#endif //USE_RLOG_INFO_CHANNEL
|
||||
#ifdef USE_RLOG_WARNING_CHANNEL
|
||||
stdLog.subscribeTo(GetGlobalChannel("warning"));
|
||||
#endif //USE_RLOG_WARNING_CHANNEL
|
||||
|
||||
// Define variables that hold the command line parameters.
|
||||
string gmshInputFile;
|
||||
string hdf5fedOutputFile;
|
||||
bool writeFileForce = false;
|
||||
|
||||
//==================================================//
|
||||
// Parse the comand line options //
|
||||
// with the program_options from the boost library. //
|
||||
//==================================================//
|
||||
try
|
||||
{
|
||||
// Define and instance of the program_options class and name it.
|
||||
boost::program_options::options_description
|
||||
desc("Allowed program options");
|
||||
// Define the command line options parsing rules.
|
||||
desc.add_options()
|
||||
("help", "produce this help")
|
||||
("input-file", boost::program_options::value<string>(),
|
||||
"gmsh v2.0 input file")
|
||||
("output-file", boost::program_options::value<string>(),
|
||||
"hdf5fed output file")
|
||||
("force", "if output file already exists, overwrite");
|
||||
// Parse the command line.
|
||||
boost::program_options::variables_map varMap;
|
||||
boost::program_options::store
|
||||
(boost::program_options::parse_command_line(argc, argv, desc),
|
||||
varMap);
|
||||
boost::program_options::notify(varMap);
|
||||
// Action in relation to the command line options.
|
||||
if (varMap.count("help"))
|
||||
{
|
||||
cout << desc << "\n";
|
||||
return ERRORCODE;
|
||||
}
|
||||
else if ((varMap.count("input-file"))
|
||||
&& (varMap.count("output-file")))
|
||||
{
|
||||
gmshInputFile = varMap["input-file"].as<string>();
|
||||
hdf5fedOutputFile = varMap["output-file"].as<string>();
|
||||
rInfo("Input filename: %s",
|
||||
gmshInputFile.c_str());
|
||||
rInfo("Output filename: %s",
|
||||
hdf5fedOutputFile.c_str());
|
||||
// Check it --force is set.
|
||||
// --force writes the output file, if the file already exists.
|
||||
if (varMap.count("force"))
|
||||
writeFileForce = true;
|
||||
else
|
||||
writeFileForce = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("You have insert wrong options.");
|
||||
rError("For details use: --help.");
|
||||
return ERRORCODE;
|
||||
}
|
||||
}
|
||||
catch(exception& error)
|
||||
{
|
||||
rError("Error: %d",error.what());
|
||||
return ERRORCODE;
|
||||
}
|
||||
|
||||
//==========================//
|
||||
// Start with the main work //
|
||||
//==========================//
|
||||
//---------------------------------------//
|
||||
// Variables for the data form gmsh file //
|
||||
//---------------------------------------//
|
||||
// Variable for the gmsh nodes.
|
||||
std::vector<vector<double> > gmshNodes;
|
||||
gmshNodes.clear();
|
||||
// Vector for the gmshs nodes index.
|
||||
std::vector<unsigned int> gmshNodesIndex;
|
||||
gmshNodesIndex.clear();
|
||||
// Vector for the gmshs tetrahedrons.
|
||||
std::vector<std::vector<unsigned int> > gmshTetrahedron;
|
||||
gmshTetrahedron.clear();
|
||||
// Vector for the gmshs tetrahedrons.
|
||||
std::vector<std::vector<unsigned int> > gmshTetrahedronTag;
|
||||
gmshTetrahedronTag.clear();
|
||||
|
||||
// Make an instance of the vtk class.
|
||||
gmsh gmshInFile;
|
||||
|
||||
// Set the file name of the input file
|
||||
gmshInFile.gmshFileName(gmshInputFile);
|
||||
|
||||
// Open the gmsh mesh file, write the content to a string and close the
|
||||
// file.
|
||||
gmshInFile.gmshOpen();
|
||||
|
||||
// Parse the gmsh mesh file.
|
||||
gmshInFile.gmshParseFile(&gmshInFile);
|
||||
|
||||
// Get a vector with all node coordinates from the gmsh file.
|
||||
gmshNodes = gmshInFile.gmshNode();
|
||||
|
||||
// Put all H5Fed funktions in here.
|
||||
#ifdef HAVE_HDF5
|
||||
// Create H5Fed class instance.
|
||||
H5Fed::H5Fed h5fedFile;
|
||||
|
||||
// Open H5Fed file for writing. Filename and file write access comes
|
||||
// from command line parameters.
|
||||
if (writeFileForce == false)
|
||||
h5fedFile.open(hdf5fedOutputFile,FILE_CREATE);
|
||||
else
|
||||
h5fedFile.open(hdf5fedOutputFile,FILE_CREATE_FORCE);
|
||||
|
||||
// Create the group hierarchie in the hdf5fed file.
|
||||
h5fedFile.createGroupHierarchie();
|
||||
|
||||
// Get the gmsh node index vector
|
||||
gmshNodesIndex = gmshInFile.gmshNodeNumber();
|
||||
|
||||
// The gmsh node index has gaps and is not consecutive.
|
||||
// So we activate the automatic index mapping from the h5fed api.
|
||||
h5fedFile.beginIndexMapping(&gmshNodesIndex);
|
||||
|
||||
// Get a vector with all node coordinates from the gmsh file.
|
||||
gmshNodes = gmshInFile.gmshNode();
|
||||
// Write the nodes to the h5fed file.
|
||||
h5fedFile.coord3d(&gmshNodes);
|
||||
// Every node in h5fed file, so we can save memory.
|
||||
gmshNodes.clear();
|
||||
|
||||
//Get a vector with all tetrahedrons from gmsh file.
|
||||
gmshTetrahedron = gmshInFile.gmshTetrahedron();
|
||||
for(int varI = 0; varI<gmshTetrahedron.size(); varI++)
|
||||
{
|
||||
// rDebug("Elem: %d Nodes: %d; %d; %d; %d", varI, gmshTetrahedron[varI][0], gmshTetrahedron[varI][1], gmshTetrahedron[varI][2], gmshTetrahedron[varI][3]);
|
||||
}
|
||||
// Write the tetrahedrons to the h5fed file on the respective level.
|
||||
h5fedFile.tetrahedron(0,&gmshTetrahedron);
|
||||
// Every terahedron in h5fed file, so we can save memory.
|
||||
gmshTetrahedron.clear();
|
||||
|
||||
//Get a vector with all tetrahedrons from gmsh file.
|
||||
gmshTetrahedronTag = gmshInFile.gmshTetrahedronTag();
|
||||
for(int varI = 0; varI<gmshTetrahedronTag.size(); varI++)
|
||||
{
|
||||
// rDebug("Elem: %d Nodes: %d; %d", varI, gmshTetrahedronTag[varI][0], gmshTetrahedronTag[varI][1]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// End with the automatic index mapping because we have no further actcion
|
||||
// with an gmsh file index.
|
||||
h5fedFile.endIndexMapping();
|
||||
|
||||
// Close H5Fed file.
|
||||
h5fedFile.close();
|
||||
|
||||
|
||||
#endif // HAVE_HDF5
|
||||
/*
|
||||
// Write all vtkPoints_ to the screen.
|
||||
for (int i = 0; i<(gmshInFile.getVtkVecSize()); i++)
|
||||
{
|
||||
rDebug("%d vtkPoint x, y, z: %e %e %e",
|
||||
i, gmshInFile.getVtkVec(i,0),gmshInFile.getVtkVec(i,1),gmshInFile.getVtkVec(i,2));
|
||||
}
|
||||
*/
|
||||
/*
|
||||
//Write all vktCells_ with cell types and cell points on the screen.
|
||||
for (int i = 0;
|
||||
(i<(gmshInFile.getVtkCellTypesN())) && (i<(gmshInFile.getVtkCellsN()));
|
||||
i++)
|
||||
{
|
||||
rDebug("vtkCellType: %d", gmshInFile.getVtkCellType(i));
|
||||
for (int j = 0; j<(gmshInFile.getVtkCellPointN(i)); j++)
|
||||
{
|
||||
rDebug(" vtkPoint: %d", gmshInFile.getVtkCellPoint(i,j));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Write all vtk point datas on the screen.
|
||||
//rDebug("size: %d", gmshInFile.vtkVectorSize("vtkPointData_"));
|
||||
for (int i = 0;
|
||||
i<(gmshInFile.vtkVectorSize("vtkPointData_"));
|
||||
i++)
|
||||
{
|
||||
for (int j = 0; j<(gmshInFile.vtkVectorSize("vtkPointData_",i)); j++)
|
||||
{
|
||||
for(int k = 0; k<(gmshInFile.vtkVectorSize("vtkPointData_",i,j)); k++)
|
||||
rDebug("vtk point vector element i, j, k, value: %d %d %d %e",
|
||||
i,j,k,gmshInFile.vtkVector("vtkPointData_",i,j,k));
|
||||
}
|
||||
}
|
||||
|
||||
// Write all vtkPointsType_ to the screen.
|
||||
rDebug("size of vtkPointDataType_: %d", gmshInFile.vtkVectorSize("vtkPointDataType_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkPointDataType_")); i++)
|
||||
{
|
||||
rDebug("vtkPointDataType_ %s", gmshInFile.vtkVector("vtkPointDataType_",i).c_str());
|
||||
}
|
||||
// Write all vtkPointsName_ to the screen.
|
||||
rDebug("size of vtkPointDataName_: %d", gmshInFile.vtkVectorSize("vtkPointDataName_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkPointDataName_")); i++)
|
||||
{
|
||||
rDebug("vtkPointName_ %s", gmshInFile.vtkVector("vtkPointDataName_",i).c_str());
|
||||
}
|
||||
// Write all vtkPointsFormat_ to the screen.
|
||||
rDebug("size of vtkPointDataFormat_: %d", gmshInFile.vtkVectorSize("vtkPointDataFormat_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkPointDataFormat_")); i++)
|
||||
{
|
||||
rDebug("vtkPointFormat_ %s", (gmshInFile.vtkVector("vtkPointDataFormat_",i)).c_str());
|
||||
}
|
||||
|
||||
|
||||
// Write all vtk point datas on the screen.
|
||||
//rDebug("size: %d", gmshInFile.vtkVectorSize("vtkCellData_"));
|
||||
for (int i = 0;
|
||||
i<(gmshInFile.vtkVectorSize("vtkCellData_"));
|
||||
i++)
|
||||
{
|
||||
for (int j = 0; j<(gmshInFile.vtkVectorSize("vtkCellData_",i)); j++)
|
||||
{
|
||||
for(int k = 0; k<(gmshInFile.vtkVectorSize("vtkCellData_",i,j)); k++)
|
||||
rDebug("vtk cell vector element i, j, k, value: %d %d %d %e",
|
||||
i,j,k,gmshInFile.vtkVector("vtkCellData_",i,j,k));
|
||||
}
|
||||
}
|
||||
|
||||
// Write all vtkCellsType_ to the screen.
|
||||
rDebug("size of vtkCellDataType_: %d", gmshInFile.vtkVectorSize("vtkCellDataType_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkCellDataType_")); i++)
|
||||
{
|
||||
rDebug("vtkCellDataType_ %s", (gmshInFile.vtkVector("vtkCellDataType_",i)).c_str());
|
||||
}
|
||||
// Write all vtkCellsName_ to the screen.
|
||||
rDebug("size of vtkCellDataName_: %d", gmshInFile.vtkVectorSize("vtkCellDataName_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkCellDataName_")); i++)
|
||||
{
|
||||
rDebug("vtkCellDataName_ %s", (gmshInFile.vtkVector("vtkCellDataName_",i)).c_str());
|
||||
}
|
||||
// Write all vtkCellsFormat_ to the screen.
|
||||
rDebug("size of vtkCellDataFormat_: %d", gmshInFile.vtkVectorSize("vtkCellDataFormat_"));
|
||||
for (int i = 0; i<(gmshInFile.vtkVectorSize("vtkCellDataFormat_")); i++)
|
||||
{
|
||||
rDebug("vtkCellDataFormat_ %s", (gmshInFile.vtkVector("vtkCellDataFormat_",i)).c_str());
|
||||
}
|
||||
*/
|
||||
|
||||
// cout <<"\n\n" <<gmshInFile.getUg PointsN()<< "\n\n";
|
||||
|
||||
// int i = gmshInFile.openVtk();
|
||||
//vtk* vtkPt;
|
||||
//vtkPt = &gmshInFile;
|
||||
//vtkPt->vtkVersion();
|
||||
|
||||
//gmshInFile.vtkVersion();
|
||||
|
||||
// This vector is used in loops to transport datas from vtk to ristream.
|
||||
vector<double> dataVector1;
|
||||
/*
|
||||
// Scaling factor for the vtk input data.
|
||||
double scale = 15.0;
|
||||
ristream rib;
|
||||
// Set the filname of the .rib file.
|
||||
rib.RibsFile(ribOutputFile);
|
||||
rib.openRibs();
|
||||
rib.RibsFormat(1024,768);
|
||||
rib.RibsLightSource("distantlight");
|
||||
rib.RibsProjection("perspective");
|
||||
//rib.RibsProjection("orthographic");
|
||||
|
||||
// Give the center or the rotation.
|
||||
double rotCenterX = 0.0;
|
||||
double rotCenterY = 0.0;
|
||||
double rotRadius = 1.6;
|
||||
double cameraPosX = sqrt(3.92); // Only the camera postion if nLoop = 1;
|
||||
double cameraPosY = 0;
|
||||
cameraPosX = 1; // Only the camera postion if nLoop = 1;
|
||||
cameraPosY = -1;
|
||||
|
||||
char filename[20];
|
||||
|
||||
const int nLoop = 1;
|
||||
for(int i = 0; i<nLoop; i++)
|
||||
{
|
||||
if (nLoop > 1)
|
||||
{
|
||||
cameraPosX = -rotRadius*cos(2*PI*i/(double)nLoop) + rotCenterX;
|
||||
cameraPosY = -rotRadius*sin(2*PI*i/(double)nLoop) + rotCenterY;
|
||||
}
|
||||
|
||||
rib.RibsFrameBegin();
|
||||
// Set the file name for the renderer output image.
|
||||
string tempstring = "";
|
||||
tempstring = "tests/movie_data/Hallo";
|
||||
//tempstring.append("%d.tiff",i);
|
||||
//tempstring.append((string)i);
|
||||
tempstring.append(".tiff");
|
||||
//sprintf ( tempchar ,"tests/movie_data/Hallo%d.tiff",i );
|
||||
// rib.RibsFrameFilename("");
|
||||
rib.RibsDisplay(frameName);
|
||||
|
||||
rDebug(tempstring.c_str());
|
||||
|
||||
// Camera Position and orientation:
|
||||
// The default camera postion is the world coordinate origin and it
|
||||
// looks in the -z-direction.
|
||||
|
||||
// The function RibsPlaceCamera set the position of the camera in world
|
||||
// coordinates and the point, where to look at in world coordinates.
|
||||
// To get a skew view, you can roll the camera.
|
||||
// This function must be called befor RibsWorldBegin!
|
||||
rib.RibsPlaceCamera(1.5*cameraPosX, 1.5*cameraPosY, 2.0, // position
|
||||
0.0, 0.0, 1.2, // look-at point
|
||||
0.0) ; // roll angle (in degree)
|
||||
|
||||
rib.RibsWorldBegin();
|
||||
rib.RibsSurface("plastic");
|
||||
rib.RibsCoordinateSystem();
|
||||
|
||||
//Write all vktCells_ with cell types and cell points on the screen.
|
||||
//rDebug("getVtkCellTypesN(): %d", gmshInFile.getVtkCellTypesN());
|
||||
for (int i = 0; i<(gmshInFile.getVtkCellTypesN()); i++)
|
||||
{
|
||||
// Look if there is a thetrahedron.
|
||||
if (gmshInFile.getVtkCellType(i) == 10)
|
||||
{
|
||||
// Clear the data structur to save the point cooridnates temporal.
|
||||
dataVector1.clear();
|
||||
|
||||
// Read the points of a tetrahedron.
|
||||
//rDebug("getVtkCellPointN(%d): %d", i, gmshInFile.getVtkCellPointN(i));
|
||||
for (int j = 0; j<(gmshInFile.getVtkCellPointN(i)); j++)
|
||||
{
|
||||
int tempInt = gmshInFile.getVtkCellPoint(i,j);
|
||||
dataVector1.push_back(gmshInFile.getVtkVec(tempInt, 0));
|
||||
dataVector1.push_back(gmshInFile.getVtkVec(tempInt, 1));
|
||||
dataVector1.push_back(gmshInFile.getVtkVec(tempInt, 2));
|
||||
//rDebug("vtkPoint: %d, %f %f %f", tempInt,
|
||||
// gmshInFile.getVtkVec(tempInt, 0),
|
||||
// gmshInFile.getVtkVec(tempInt, 1),
|
||||
// gmshInFile.getVtkVec(tempInt, 2));
|
||||
|
||||
}
|
||||
rib.RibsColor(0.0,0,1.0,1.0);
|
||||
rib.RibsTetrahedron(scale*dataVector1[0], scale*dataVector1[1], scale*dataVector1[2],
|
||||
scale*dataVector1[3], scale*dataVector1[4], scale*dataVector1[5],
|
||||
scale*dataVector1[6], scale*dataVector1[7], scale*dataVector1[8],
|
||||
scale*dataVector1[9], scale*dataVector1[10],scale*dataVector1[11],
|
||||
0.8);
|
||||
}
|
||||
}
|
||||
*/
|
||||
/*
|
||||
rib.RibsColor(1.0,0,0,0.6);
|
||||
rib.RibsTetrahedron(0.3, 0.3, 0.0,
|
||||
2.0, 0.3, 0.0,
|
||||
0.3, 2.0, 0.0,
|
||||
0.3, 0.3, 0.5,
|
||||
1.0);
|
||||
rib.RibsColor(0,1.0,0,0.7);
|
||||
rib.RibsTetrahedron(0.3, 0.3, 0.0,
|
||||
2.0, 0.3, 0.0,
|
||||
0.3, 2.0, 0.0,
|
||||
0.3, 0.3, 0.5,
|
||||
0.6);
|
||||
|
||||
rib.RibsColor(0.0,0,1.0,1.0);
|
||||
rib.RibsTetrahedron(0.3, 0.3, 0.0,
|
||||
2.0, 0.3, 0.0,
|
||||
0.3, 2.0, 0.0,
|
||||
0.3, 0.3, 0.5,
|
||||
0.3);
|
||||
*/
|
||||
// rib,RibsAxes();
|
||||
// rib.RibsVector(0,0,0,0.5);
|
||||
/*
|
||||
rib.RibsWorldEnd();
|
||||
rib.RibsFrameEnd();
|
||||
}
|
||||
rib.closeRibs();
|
||||
*/
|
||||
// return(0);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// rights - 2006-, copyright benedikt oswald and patrick leidenberger, all rights reserved
|
||||
// project - phidias3d
|
||||
// file name - phidias3d.h
|
||||
// file type - c++ header file
|
||||
// objective - header file for the phidias3d visualization postprocessor
|
||||
// modified - 2006 jun 26, creation, benedikt oswald
|
||||
// modified - 2006 jun 28,
|
||||
// modified - 2006 jul 30, Add include for command line argument parser
|
||||
// with boost::program_options, pl.
|
||||
// inheritance -
|
||||
// feature - implements the phidias3d visualization postprocessor; the features
|
||||
// feature - will be (1) read VTK legacy formatted files (2) read HDF5/ELECTROMAGNETIC
|
||||
// feature - structures files (3) export VTK legacy formatted files (4) export
|
||||
// feature - data, both meshes and fields, throught the Renderman Interface
|
||||
// feature - routines.
|
||||
// required software -
|
||||
|
||||
|
||||
/* include standard header files */
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <math.h>
|
||||
|
||||
/* Include the files for rlog. */
|
||||
#include <rlog/rlog.h>
|
||||
#include <rlog/rloglocation.h>
|
||||
#include <rlog/Error.h>
|
||||
#include <rlog/RLogChannel.h>
|
||||
#include <rlog/StdioNode.h>
|
||||
// Include this if you want to log the time.
|
||||
#include <rlog/RLogTime.h>
|
||||
|
||||
// Include the boost program program_options to parse the comand line
|
||||
// options.
|
||||
#include <boost/program_options.hpp>
|
||||
|
||||
|
||||
/* include standard proprietary header files */
|
||||
#include <nonsciconst.h>
|
||||
#include <physicomath.h>
|
||||
//#include <ristream.h>
|
||||
#include <gmsh.hh>
|
||||
|
||||
// Include the Hdf5FiniteElementData API.
|
||||
#ifdef HAVE_HDF5
|
||||
// Include the Hdf5FiniteElementData API.
|
||||
#include <h5fed.hh>
|
||||
// Include h5fed specific constants.
|
||||
#include <h5fedconst.hh>
|
||||
#else
|
||||
#warning No hdf5 lib found!!
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#ifndef PHIDIAS3D_H_
|
||||
#define PHIDIAS3D_H_
|
||||
|
||||
using namespace physicomath;
|
||||
using namespace nonsciconst;
|
||||
using namespace gmshtohdf5fed;
|
||||
|
||||
|
||||
|
||||
#endif /*PHIDIAS3D_H_*/
|
||||
@@ -0,0 +1,26 @@
|
||||
## Makefile.am -- process this file with automake to produce Makefile.in
|
||||
##
|
||||
## authors - benedikt oswald and patrick leidenberger
|
||||
## modified - 2006 aug 21, patrick leidenberger, creation
|
||||
## modified - 2006 aug 23, pl, adaped to changed directory structure.
|
||||
## modified - 2006 aug 25, pl, adaped to changed directory structure.
|
||||
#
|
||||
## objective - automake input file for the gmsh directory
|
||||
## project - gmsh2h5fed
|
||||
|
||||
noinst_PROGRAMS = gmsh2h5fed
|
||||
|
||||
gmsh2h5fed_SOURCES = gmsh2h5fed.cc
|
||||
gmsh2h5fed_DEPENDENCIES = ../libsrc/stdincl/nonsciconst.h \
|
||||
../libsrc/stdincl/physicomath.h \
|
||||
../libsrc/gmsh/gmsh.hh \
|
||||
../libsrc/gmsh/gmsh.cc \
|
||||
../libsrc/gmsh/gmshconst.hh \
|
||||
../libsrc/gmsh/gmshgrammar.hh \
|
||||
../libsrc/gmsh/gmshsemanticaction.hh \
|
||||
../libsrc/h5fed/h5fed.hh \
|
||||
../libsrc/h5fed/h5fed.cc
|
||||
|
||||
gmsh2h5fed_LDADD = @GMSH2H5FED_LIBS@
|
||||
|
||||
#AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
libtoolize -f && \
|
||||
aclocal && \
|
||||
autoconf && \
|
||||
autoheader && \
|
||||
automake --add-missing && \
|
||||
CC='mpicc' F9X='mpif90' CXX='mpiCC' ./configure --with-rlog=$HOME/extlib/rlog-1.3.7 --with-boost='' --with-hdf5=$HOME/extlib/hdf5-1.6.5 &&\
|
||||
make clean && \
|
||||
make all
|
||||
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
## Process this file with autoconf to produce a configure script
|
||||
##
|
||||
## author - benedikt oswald and patrick leidenberger
|
||||
## modified - 2006 aug 21, pl, creation.
|
||||
## modified - 2006 aug 24, pl, add h5fed path.
|
||||
##
|
||||
## to do : The rlog lib needs a -DRLOG_COMPONENT="some name", I don't know
|
||||
## how tho do this so that the quotation marks are in the output
|
||||
## stream as well, pl, 2006 jul 04.
|
||||
##
|
||||
## objective - develop input file for GNU autotools/configure
|
||||
## project - H5Fed
|
||||
##
|
||||
|
||||
AC_PREREQ(2.59)
|
||||
AC_COPYRIGHT([This configure script is copyright by Benedikt Oswald and Patrick Leidenberger, 2006])
|
||||
|
||||
AC_INIT([gmshtohdf5fed], [1.0], [in case of problems mail to: benedikt.oswald@psi.ch or patrick.leidenberger@psi.ch])
|
||||
|
||||
# library creation
|
||||
AC_PROG_LIBTOOL
|
||||
|
||||
# standard macros
|
||||
AC_CONFIG_AUX_DIR(./)
|
||||
AM_INIT_AUTOMAKE
|
||||
AC_CONFIG_HEADER([./config.h:./config.in])
|
||||
|
||||
# set cppflags to zero
|
||||
CPPFLAGS=""
|
||||
CFFLAGS=""
|
||||
CXXFLAGS=""
|
||||
|
||||
# provide include directories
|
||||
AC_SUBST([AM_CPPFLAGS], '-I$(top_srcdir)/libsrc/stdincl -I$(top_srcdir)/libsrc/gmsh -I$(top_srcdir)/libsrc/h5fed')
|
||||
AC_SUBST([GMSH2H5FED_LIBS],'$(top_srcdir)/libsrc/gmsh/libgmsh.la $(top_srcdir)/libsrc/h5fed/libh5fed.la')
|
||||
|
||||
# Make available external libraries
|
||||
AC_ARG_WITH(boost,
|
||||
AC_HELP_STRING([--with-boost=PREFIX],
|
||||
[prefix where the Boost libraries and include files are to be found]),
|
||||
[BOOST_PREFIX=$withval
|
||||
LDFLAGS="-lz -lboost_program_options "])
|
||||
|
||||
AC_ARG_WITH(rlog,
|
||||
AC_HELP_STRING([--with-rlog=PREFIX],
|
||||
[prefix where the rlog libraries and include files are to be found]),
|
||||
[RLOG_PREFIX=$withval
|
||||
CPPFLAGS="-I"$RLOG_PREFIX"/include "${CPPFLAGS}
|
||||
LDFLAGS=$RLOG_PREFIX"/lib/librlog.la "${LDFLAGS}])
|
||||
|
||||
AC_ARG_ENABLE(rlog-debug,
|
||||
AC_HELP_STRING([--disable-rlog-debug],
|
||||
[disable the debug output channel of rlog]),
|
||||
[],
|
||||
[CFFLAGS="-DUSE_RLOG_DEBUG_CHANNEL "${CFFLAGS}
|
||||
CXXFLAGS="-DUSE_RLOG_DEBUG_CHANNEL "${CXXFLAGS}])
|
||||
|
||||
AC_ARG_ENABLE(rlog-error,
|
||||
AC_HELP_STRING([--disable-rlog-error],
|
||||
[disable the error output channel of rlog]),
|
||||
[],
|
||||
[CFFLAGS="-DUSE_RLOG_ERROR_CHANNEL "${CFFLAGS}
|
||||
CXXFLAGS="-DUSE_RLOG_ERROR_CHANNEL "${CXXFLAGS}])
|
||||
|
||||
AC_ARG_ENABLE(rlog-info,
|
||||
AC_HELP_STRING([--disable-rlog-info],
|
||||
[disable the info output channel of rlog]),
|
||||
[],
|
||||
[CFFLAGS="-DUSE_RLOG_INFO_CHANNEL "${CFFLAGS}
|
||||
CXXFLAGS="-DUSE_RLOG_INFO_CHANNEL "${CXXFLAGS}])
|
||||
|
||||
AC_ARG_ENABLE(rlog-warning,
|
||||
AC_HELP_STRING([--disable-rlog-warning],
|
||||
[disable the warning output channel of rlog]),
|
||||
[],
|
||||
[CFFLAGS="-DUSE_RLOG_WARNING_CHANNEL "${CFFLAGS}
|
||||
CXXFLAGS="-DUSE_RLOG_WARNING_CHANNEL "${CXXFLAGS}])
|
||||
|
||||
AC_ARG_WITH(hdf5,
|
||||
AC_HELP_STRING([--with-hdf5=PREFIX],
|
||||
[prefix to hdf5 libraries and include files]),
|
||||
[HDF5_PREFIX=$withval
|
||||
CPPFLAGS="-DHAVE_HDF5 -I"$HDF5_PREFIX"/include "${CPPFLAGS}
|
||||
LDFLAGS="-L"$HDF5_PREFIX"/lib -lhdf5 "${LDFLAGS}])
|
||||
# LDFLAGS=$HDF5_PREFIX"/lib/libhdf5.la "${LDFLAGS}])
|
||||
|
||||
|
||||
# Set C/C++ compiler flags.
|
||||
CPPFLAGS=${CPPFLAGS}
|
||||
CFFLAGS="-g3 "${CFFLAGS}
|
||||
CXXFLAGS="-g3 "${CXXFLAGS}
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 foreign])
|
||||
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
AC_PROG_INSTALL([install])
|
||||
|
||||
AC_CONFIG_FILES([makefile
|
||||
applications/makefile
|
||||
libsrc/makefile
|
||||
libsrc/gmsh/makefile
|
||||
libsrc/h5fed/makefile])
|
||||
|
||||
|
||||
AC_OUTPUT
|
||||
@@ -0,0 +1,114 @@
|
||||
// rights - 2002-2005, benedikt oswald,
|
||||
// project - aq
|
||||
// file name - cube0.geo
|
||||
// file type - GMSH script file
|
||||
// objective - model cube fundamental cube
|
||||
// modified - 2005 jan 25, benedikt oswald, creation
|
||||
// modified - 2005 jan 25, benedikt oswald, added background hexahedron, subsurface hexahedron
|
||||
// modified - 2005 feb 01, benedikt oswald, adapted to the simple.geo problem
|
||||
// modified - 2005 mar 08, benedikt oswald, adapted to the cube in cube geometry
|
||||
// modified - 2005 mar 22, benedikt oswald, adapted to model fundamental cube
|
||||
// inheritance -
|
||||
// feature - models fundamental cube, used for benchmark calculations of a Hertzian dipole
|
||||
// feature - radiating into free space; the model uses standard physical domain tags;
|
||||
|
||||
|
||||
// 1 modeling constants
|
||||
|
||||
lcl1=0.50; // characteristic length in fractions of lambda@1 GHz for air domain
|
||||
lcl2=0.50; // characteristic length in fractions of lambda@1 GHz for air domain
|
||||
|
||||
lambda=0.30; // wavelength of electromagntic wave at a frequency of 1 GHz
|
||||
|
||||
lx=2.0; // x dim of computational domain
|
||||
ly=2.0; // y dim of computational domain
|
||||
lz=2.0; // z dim of computational domain
|
||||
|
||||
cx=0.5*lx; // calculate center of computational domain
|
||||
cy=0.5*ly; // calculate center of computational domain
|
||||
cz=0.5*lz; // calculate center of computational domain
|
||||
|
||||
|
||||
// 1.2 Define physical material domains
|
||||
|
||||
vacuum=609; // physical entity vacuum
|
||||
air=709; // physical entity air
|
||||
subsurface=809; // physical entity subsurface
|
||||
pml=1301; // physical entity pml material
|
||||
icelens=4001; // physical entity icelens
|
||||
vacuum_background_bnd=12701; // boundary to background, i.e. vacuum
|
||||
interelement_bnd=12702; // interior boundary, separating different material domains
|
||||
|
||||
|
||||
|
||||
// 2 Define cubes
|
||||
// 2.1.1 Define points of cube
|
||||
|
||||
p0=newp; Point(p0) = {0.0, 0.0, 0.0, lambda * lcl1};
|
||||
p1=newp; Point(p1) = { lx, 0.0, 0.0, lambda * lcl1};
|
||||
p2=newp; Point(p2) = { lx, ly, 0.0, lambda * lcl1};
|
||||
p3=newp; Point(p3) = {0.0, ly, 0.0, lambda * lcl1};
|
||||
p4=newp; Point(p4) = {0.0, 0.0, lz, lambda * lcl1};
|
||||
p5=newp; Point(p5) = { lx, 0.0, lz, lambda * lcl1};
|
||||
p6=newp; Point(p6) = { lx, ly, lz, lambda * lcl1};
|
||||
p7=newp; Point(p7) = {0.0, ly, lz, lambda * lcl1};
|
||||
|
||||
// 2.1.3 Define lines of cube
|
||||
|
||||
// lower xy plane
|
||||
li0=newl; Line(li0) = {p0,p1};
|
||||
li1=newl; Line(li1) = {p1,p2};
|
||||
li2=newl; Line(li2) = {p2,p3};
|
||||
li3=newl; Line(li3) = {p3,p0};
|
||||
|
||||
// upper xy plane
|
||||
li4=newl; Line(li4) = {p4,p5};
|
||||
li5=newl; Line(li5) = {p5,p6};
|
||||
li6=newl; Line(li6) = {p6,p7};
|
||||
li7=newl; Line(li7) = {p7,p4};
|
||||
|
||||
// vertical lines
|
||||
li8=newl; Line(li8) = {p0,p4};
|
||||
li9=newl; Line(li9) = {p1,p5};
|
||||
li10=newl; Line(li10) = {p2,p6};
|
||||
li11=newl; Line(li11) = {p3,p7};
|
||||
|
||||
|
||||
// 2.1.5 Define line 6 line loops for the 6 faces of the cube
|
||||
|
||||
lloop0= newreg; Line Loop(lloop0) = { li0, li1, li2, li3};
|
||||
lloop1= newreg; Line Loop(lloop1) = { li4, li5, li6, li7};
|
||||
|
||||
lloop2= newreg; Line Loop(lloop2) = { li0, li9, -li4, -li8 };
|
||||
lloop3= newreg; Line Loop(lloop3) = { li1, li10, -li5, -li9};
|
||||
|
||||
lloop4= newreg; Line Loop(lloop4) = { li2, li11, -li6, -li10};
|
||||
lloop5= newreg; Line Loop(lloop5) = { li3, li8, -li7, -li11};
|
||||
|
||||
|
||||
// 2.1.7 define plane surfaces for the cube
|
||||
|
||||
s0=news; Plane Surface(s0) = {lloop0};
|
||||
s1=news; Plane Surface(s1) = {lloop1};
|
||||
s2=news; Plane Surface(s2) = {lloop2};
|
||||
s3=news; Plane Surface(s3) = {lloop3};
|
||||
s4=news; Plane Surface(s4) = {lloop4};
|
||||
s5=news; Plane Surface(s5) = {lloop5};
|
||||
|
||||
|
||||
// 2.1.9 Define surface loops required for volume definition of the cube
|
||||
|
||||
sloop0=newreg; Surface Loop(sloop0) ={s0,s1,s2,s3,s4,s5};
|
||||
|
||||
// 2.1.10 Define volume of the cube
|
||||
|
||||
v0=newv; Volume(v0) = {sloop0};
|
||||
|
||||
// 3.0 define physical entitites
|
||||
|
||||
Physical Point(vacuum_background_bnd) = {p0:p7};
|
||||
Physical Line(vacuum_background_bnd) = {li0:li11};
|
||||
Physical Surface(vacuum_background_bnd) = {s0:s5};
|
||||
Physical Volume(air) = {v0};
|
||||
|
||||
|
||||
+21463
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,206 @@
|
||||
// rights - 2002-2005, benedikt oswald,
|
||||
// project - aq
|
||||
// file name - cubeincube.geo
|
||||
// file type - GMSH script file
|
||||
// objective - model cube in a cube mesh, useful for PML booundary conditions
|
||||
// modified - 2005 jan 25, benedikt oswald, creation
|
||||
// modified - 2005 jan 25, benedikt oswald, added background hexahedron, subsurface hexahedron
|
||||
// modified - 2005 feb 01, benedikt oswald, adapted to the simple.geo problem
|
||||
// modified - 2005 mar 08, benedikt oswald, adapted to the cube in cube geometry
|
||||
// inheritance -
|
||||
// feature - models a cube in a cube mesh, useful for PML booundary conditions;
|
||||
// feature - the PML boundary model is based on a 3D region with special electromagnetic
|
||||
// feature - material properties which guarantee, in theory, perfect absorption of incident
|
||||
// feature - electromagnetic waves independent of the angle between the wave vector
|
||||
// feature - and the boundary; in order to model the PML material domain a separate mesh
|
||||
// feature - region is created so that there is a clean boundary between the PML and
|
||||
// feature - and the air region.
|
||||
|
||||
|
||||
// 1 modeling constants
|
||||
|
||||
lcair=0.90; // characteristic length in fractions of lambda@1 GHz for air domain
|
||||
lcpml=0.70; // characteristic length in fractions of lambda@1 GHz for PML region
|
||||
lambda=0.30; // wavelength of electromagntic wave at a frequency of 1 GHz
|
||||
|
||||
lx=1.0; // x dim of computational domain
|
||||
ly=1.0; // y dim of computational domain
|
||||
lz=1.0; // z dim of computational domain
|
||||
|
||||
cx=0.5*lx; // calculate center of computational domain
|
||||
cy=0.5*ly; // calculate center of computational domain
|
||||
cz=0.5*lz; // calculate center of computational domain
|
||||
|
||||
lpmlxl=0.1; // thickness of PML region
|
||||
lpmlxh=0.1; // thickness of PML region
|
||||
|
||||
lpmlyl=0.1; // thickness of PML region
|
||||
lpmlyh=0.1; // thickness of PML region
|
||||
|
||||
lpmlzl=0.1; // thickness of PML region
|
||||
lpmlzh=0.1; // thickness of PML region
|
||||
|
||||
xminic=lpmlxl; // x min of inner cube
|
||||
xmaxic=lx-lpmlxh; // x max of inner cube
|
||||
yminic=lpmlyl; // y min of inner cube
|
||||
ymaxic=ly-lpmlyh; // y max of inner cube
|
||||
zminic=lpmlzl; // z min of inner cube
|
||||
zmaxic=lz-lpmlzh; // z max of inner cube
|
||||
|
||||
// 1.2 Define physical material domains
|
||||
|
||||
vacuum=609; // physical entity vacuum
|
||||
air=709; // physical entity air
|
||||
pml=1301; // physical entity pml material
|
||||
icelens=4001; // physical entity icelens
|
||||
vacuum_background_bnd=12701; // boundary to background, i.e. vacuum
|
||||
interelement_bnd=12702; // interior boundary, separating different material domains
|
||||
|
||||
|
||||
|
||||
// 2 Define cubes
|
||||
// 2.1.1 Define points of outer cube
|
||||
|
||||
p0=newp; Point(p0) = {0.0, 0.0, 0.0, lambda * lcpml};
|
||||
p1=newp; Point(p1) = { lx, 0.0, 0.0, lambda * lcpml};
|
||||
p2=newp; Point(p2) = { lx, ly, 0.0, lambda * lcpml};
|
||||
p3=newp; Point(p3) = {0.0, ly, 0.0, lambda * lcpml};
|
||||
p4=newp; Point(p4) = {0.0, 0.0, lz, lambda * lcpml};
|
||||
p5=newp; Point(p5) = { lx, 0.0, lz, lambda * lcpml};
|
||||
p6=newp; Point(p6) = { lx, ly, lz, lambda * lcpml};
|
||||
p7=newp; Point(p7) = {0.0, ly, lz, lambda * lcpml};
|
||||
|
||||
// 2.1.2 Define points of inner cube
|
||||
|
||||
p100=newp; Point(p100) = {xminic, yminic, zminic, lambda * lcair};
|
||||
p101=newp; Point(p101) = {xmaxic, yminic, zminic, lambda * lcair};
|
||||
p102=newp; Point(p102) = {xmaxic, ymaxic, zminic, lambda * lcair};
|
||||
p103=newp; Point(p103) = {xminic, ymaxic, zminic, lambda * lcair};
|
||||
|
||||
p104=newp; Point(p104) = {xminic, yminic, zmaxic, lambda * lcair};
|
||||
p105=newp; Point(p105) = {xmaxic, yminic, zmaxic, lambda * lcair};
|
||||
p106=newp; Point(p106) = {xmaxic, ymaxic, zmaxic, lambda * lcair};
|
||||
p107=newp; Point(p107) = {xminic, ymaxic, zmaxic, lambda * lcair};
|
||||
|
||||
|
||||
// 2.1.3 Define lines of outer cube
|
||||
|
||||
// lower xy plane
|
||||
li0=newl; Line(li0) = {p0,p1};
|
||||
li1=newl; Line(li1) = {p1,p2};
|
||||
li2=newl; Line(li2) = {p2,p3};
|
||||
li3=newl; Line(li3) = {p3,p0};
|
||||
|
||||
// upper xy plane
|
||||
li4=newl; Line(li4) = {p4,p5};
|
||||
li5=newl; Line(li5) = {p5,p6};
|
||||
li6=newl; Line(li6) = {p6,p7};
|
||||
li7=newl; Line(li7) = {p7,p4};
|
||||
|
||||
// vertical lines
|
||||
li8=newl; Line(li8) = {p0,p4};
|
||||
li9=newl; Line(li9) = {p1,p5};
|
||||
li10=newl; Line(li10) = {p2,p6};
|
||||
li11=newl; Line(li11) = {p3,p7};
|
||||
|
||||
// 2.1.4 Define lines of outer cube
|
||||
|
||||
// lower xy plane
|
||||
li100=newl; Line(li100) = {p100,p101};
|
||||
li101=newl; Line(li101) = {p101,p102};
|
||||
li102=newl; Line(li102) = {p102,p103};
|
||||
li103=newl; Line(li103) = {p103,p100};
|
||||
|
||||
// upper xy plane
|
||||
li104=newl; Line(li104) = {p104,p105};
|
||||
li105=newl; Line(li105) = {p105,p106};
|
||||
li106=newl; Line(li106) = {p106,p107};
|
||||
li107=newl; Line(li107) = {p107,p104};
|
||||
|
||||
// vertical lines
|
||||
li108=newl; Line(li108) = {p100,p104};
|
||||
li109=newl; Line(li109) = {p101,p105};
|
||||
li110=newl; Line(li110) = {p102,p106};
|
||||
li111=newl; Line(li111) = {p103,p107};
|
||||
|
||||
|
||||
// 2.1.5 Define line 6 line loops for the 6 faces of outer cube
|
||||
|
||||
lloop0= newreg; Line Loop(lloop0) = { li0, li1, li2, li3};
|
||||
lloop1= newreg; Line Loop(lloop1) = { li4, li5, li6, li7};
|
||||
|
||||
lloop2= newreg; Line Loop(lloop2) = { li0, li9, -li4, -li8 };
|
||||
lloop3= newreg; Line Loop(lloop3) = { li1, li10, -li5, -li9};
|
||||
|
||||
lloop4= newreg; Line Loop(lloop4) = { li2, li11, -li6, -li10};
|
||||
lloop5= newreg; Line Loop(lloop5) = { li3, li8, -li7, -li11};
|
||||
|
||||
|
||||
// 2.1.6 Define line 6 line loops for the 6 faces of inner cube
|
||||
|
||||
lloop100= newreg; Line Loop(lloop100) = { li100, li101, li102, li103};
|
||||
lloop101= newreg; Line Loop(lloop101) = { li104, li105, li106, li107};
|
||||
|
||||
lloop102= newreg; Line Loop(lloop102) = { li100, li109, -li104, -li108 };
|
||||
lloop103= newreg; Line Loop(lloop103) = { li101, li110, -li105, -li109};
|
||||
|
||||
lloop104= newreg; Line Loop(lloop104) = { li102, li111, -li106, -li110};
|
||||
lloop105= newreg; Line Loop(lloop105) = { li103, li108, -li107, -li111};
|
||||
|
||||
|
||||
// 2.1.7 define plane surfaces for outer cube
|
||||
|
||||
s0=news; Plane Surface(s0) = {lloop0};
|
||||
s1=news; Plane Surface(s1) = {lloop1};
|
||||
s2=news; Plane Surface(s2) = {lloop2};
|
||||
s3=news; Plane Surface(s3) = {lloop3};
|
||||
s4=news; Plane Surface(s4) = {lloop4};
|
||||
s5=news; Plane Surface(s5) = {lloop5};
|
||||
|
||||
// 2.1.8 define plane surfaces for inner cube
|
||||
|
||||
s100=news; Plane Surface(s100) = {lloop100};
|
||||
s101=news; Plane Surface(s101) = {lloop101};
|
||||
s102=news; Plane Surface(s102) = {lloop102};
|
||||
s103=news; Plane Surface(s103) = {lloop103};
|
||||
s104=news; Plane Surface(s104) = {lloop104};
|
||||
s105=news; Plane Surface(s105) = {lloop105};
|
||||
|
||||
|
||||
// 2.1.9 Define surface loops required for volume definition of outer cube
|
||||
|
||||
sloop0=newreg; Surface Loop(sloop0) ={s0,s1,s2,s3,s4,s5};
|
||||
|
||||
|
||||
// 2.1.9 Define surface loops required for volume definition of inner cube
|
||||
|
||||
sloop100=newreg; Surface Loop(sloop100) ={s100,s101,s102,s103,s104,s105};
|
||||
|
||||
|
||||
// 2.1.10 Define volume of outer cube
|
||||
|
||||
v0=newv; Volume(v0) = {sloop0,sloop100};
|
||||
|
||||
|
||||
// 2.1.11 Define volume of inner cube
|
||||
|
||||
v100=newv; Volume(v100) = {sloop100};
|
||||
|
||||
|
||||
// 3.0 define physical entitites
|
||||
|
||||
Physical Point(vacuum_background_bnd) = {p0,p1,p2,p3,p4,p5,p6,p7};
|
||||
Physical Line(vacuum_background_bnd) = {li0,li1,li2,li3,li4,li5,li6,li7,li8,li9,li10,li11};
|
||||
//Physical Line Loop(vacuum_background_bnd) = {lloop0,lloop1,lloop2,lloop3,lloop4,lloop5};
|
||||
Physical Surface(vacuum_background_bnd) = {s0,s1,s2,s3,s4,s5};
|
||||
//Physical Surface Loop(vacuum_background_bnd) = {sloop0};
|
||||
Physical Volume(pml) = {v0};
|
||||
|
||||
Physical Point(interelement_bnd) = {p100,p101,p102,p103,p104,p105,p106,p107};
|
||||
Physical Line(interelement_bnd) = {li100,li101,li102,li103,li104,li105,li106,li107,li108,li109,li110,li111};
|
||||
//Physical Line Loop(interelement_bnd) = {lloop100,lloop101,lloop102,lloop103,lloop104,lloop105};
|
||||
Physical Surface(interelement_bnd) = {s100,s101,s102,s103,s104,s105};
|
||||
//Physical Surface Loop(interelement_bnd) = {sloop100};
|
||||
Physical Volume(air) = {v100};
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,135 @@
|
||||
// rights - 2002-2005, benedikt oswald,
|
||||
// project - aq
|
||||
// file name - sphere.geo
|
||||
// file type - GMSH script file
|
||||
// objective - model cube in a cube, 2 spherical objects mesh to investigate sub lambda resolution capability
|
||||
// modified - 2005 jan 25, benedikt oswald, creation
|
||||
// modified - 2005 jan 25, benedikt oswald, added background hexahedron, subsurface hexahedron
|
||||
// modified - 2005 feb 01, benedikt oswald, adapted to the simple.geo problem
|
||||
// modified - 2005 mar 08, benedikt oswald, adapted to the cube in cube geometry
|
||||
// modified - 2005 mar 09, benedikt oswald, adapted to cube in cube and spherical particle configuration
|
||||
// modified - 2005 mar 11, benedikt oswald, adapted to investigation of sub-lambda resolution capability
|
||||
// modified - 2005 mar 22, benedikt oswald, adapted to be based on reference background medium subLambda310.geo
|
||||
// modified - 2005 mar 23, benedikt oswald, adapted to model a microresonator geometry
|
||||
// modified - 2005 mar 29, benedikt oswald, adapted to model a high quality sphere for a Hertzian dipole benchmark
|
||||
// modified - 2005
|
||||
// inheritance -
|
||||
// feature - models a microresonator geometry; a dielectric sphere within an air sphere; the dielectric
|
||||
// feature - sphere will be excited by a Hertzian dipole in the vicinity of the sphere;
|
||||
// feature -
|
||||
|
||||
|
||||
// 1 modeling constants
|
||||
|
||||
lcair=1.20; // characteristic length in fractions of lambda@1 GHz for air domain
|
||||
lcsubsurface=1.20; // characteristic length in fractions of lambda@1 GHz for subsurface domain
|
||||
lcil1=0.80; // characteristic length in fractions of lambda@1 GHz for icelens region
|
||||
lcil2=0.40; // characteristic length in fractions of lambda@1 GHz for icelens 2 region
|
||||
lambda=3.0e-1; // wavelength of electromagntic wave at a frequency of 1 GHz
|
||||
|
||||
lx=3.0; // x dim of computational domain
|
||||
ly=3.0; // y dim of computational domain
|
||||
lz=2.0; // z dim of computational domain
|
||||
|
||||
cx=0.5*lx; // calculate center of computational domain
|
||||
cy=0.5*ly; // calculate center of computational domain
|
||||
cz=0.5*lz; // calculate center of computational domain
|
||||
|
||||
dxl=0.3; // thickness of PML region
|
||||
dxh=0.3; // thickness of PML region
|
||||
|
||||
dyl=0.3; // thickness of PML region
|
||||
dyh=0.3; // thickness of PML region
|
||||
|
||||
dzl=0.30; // thickness of PML region
|
||||
dzh=0.60; // thickness of PML region
|
||||
|
||||
xminic=dxl; // x min of inner cube
|
||||
xmaxic=lx-dxh; // x max of inner cube
|
||||
yminic=dyl; // y min of inner cube
|
||||
ymaxic=ly-dyh; // y max of inner cube
|
||||
zminic=dzl; // z min of inner cube
|
||||
zmaxic=lz-dzh; // z max of inner cube
|
||||
|
||||
dsx=0.10; // x distance separating the two spherical scatterers
|
||||
dsy=0.00; // y distance separating the two spherical scatterers
|
||||
dsz=0.00; // z distance separating the two spherical scatterers
|
||||
|
||||
r1=1.0; // radius of air sphere
|
||||
ilcx=0.0; // x center of air sphere
|
||||
ilcy=0.0; // y center of
|
||||
ilcz=0.0; // z center of
|
||||
|
||||
r2=2.0e-6; // radius of dielectric sphere
|
||||
il2cx=0.0; // x center of dielectric sphere
|
||||
il2cy=0.0; // y center of dielectric sphere
|
||||
il2cz=0.0; // z center of dielectric sphere
|
||||
|
||||
|
||||
// 1.2 Define physical material domains
|
||||
|
||||
vacuum=609; // physical entity vacuum
|
||||
air=709; // physical entity air
|
||||
subsurface=809; // physical entity subsurface
|
||||
pml=1301; // physical entity pml material
|
||||
icelens1=4001; // physical entity icelens
|
||||
icelens2=4003; // physical entity icelens 2
|
||||
dielsphere=4005; // physical entity dielectric sphere
|
||||
vacuum_background_bnd=12701; // boundary to background, i.e. vacuum
|
||||
air_soil_bnd=12702; // interior boundary, separating air and subsurface material
|
||||
soil_icelens1_bnd=12703; // interior boundary, separating background subsurface from icelens particle
|
||||
soil_icelens2_bnd=12705; // interior boundary, separating background subsurface from icelens 2 particle
|
||||
dielectric_sphere_bnd=12707; // interior boundary, separting air background from dielectric sphere
|
||||
|
||||
|
||||
// 2.2.1 Define air sphere 1
|
||||
|
||||
ilp1 = newp; Point(ilp1) = {ilcx, ilcy, ilcz, lcil1 * lambda} ;
|
||||
ilp2 = newp; Point(ilp2) = {ilcx+r1, ilcy, ilcz, lcil1 * lambda} ;
|
||||
ilp3 = newp; Point(ilp3) = {ilcx, ilcy+r1, ilcz, lcil1 * lambda} ;
|
||||
ilp4 = newp; Point(ilp4) = {ilcx, ilcy, ilcz+r1, lcil1 * lambda} ;
|
||||
ilp5 = newp; Point(ilp5) = {ilcx-r1, ilcy, ilcz, lcil1 * lambda} ;
|
||||
ilp6 = newp; Point(ilp6) = {ilcx, ilcy-r1, ilcz, lcil1 * lambda} ;
|
||||
ilp7 = newp; Point(ilp7) = {ilcx, ilcy, ilcz-r1, lcil1 * lambda} ;
|
||||
|
||||
ilc1 = newreg; Circle(ilc1) = {ilp2,ilp1,ilp7};
|
||||
ilc2 = newreg; Circle(ilc2) = {ilp7,ilp1,ilp5};
|
||||
ilc3 = newreg; Circle(ilc3) = {ilp5,ilp1,ilp4};
|
||||
ilc4 = newreg; Circle(ilc4) = {ilp4,ilp1,ilp2};
|
||||
ilc5 = newreg; Circle(ilc5) = {ilp2,ilp1,ilp3};
|
||||
ilc6 = newreg; Circle(ilc6) = {ilp3,ilp1,ilp5};
|
||||
ilc7 = newreg; Circle(ilc7) = {ilp5,ilp1,ilp6};
|
||||
ilc8 = newreg; Circle(ilc8) = {ilp6,ilp1,ilp2};
|
||||
ilc9 = newreg; Circle(ilc9) = {ilp7,ilp1,ilp3};
|
||||
ilc10 = newreg; Circle(ilc10) = {ilp3,ilp1,ilp4};
|
||||
ilc11 = newreg; Circle(ilc11) = {ilp4,ilp1,ilp6};
|
||||
ilc12 = newreg; Circle(ilc12) = {ilp6,ilp1,ilp7};
|
||||
|
||||
// We need non-plane surfaces to define the spherical icelens:
|
||||
// here we use ruled surfaces, which can have 3 or 4
|
||||
// sides:
|
||||
|
||||
ill1 = newreg; Line Loop(ill1) = {ilc5,ilc10,ilc4}; ilruls1=newreg; Ruled Surface(ilruls1) = {ill1};
|
||||
ill2 = newreg; Line Loop(ill2) = {ilc9,-ilc5,ilc1}; ilruls2=newreg; Ruled Surface(ilruls2) = {ill2};
|
||||
ill3 = newreg; Line Loop(ill3) = {ilc12,-ilc8,-ilc1}; ilruls3=newreg; Ruled Surface(ilruls3) = {ill3};
|
||||
ill4 = newreg; Line Loop(ill4) = {ilc8,-ilc4,ilc11}; ilruls4=newreg; Ruled Surface(ilruls4) = {ill4};
|
||||
ill5 = newreg; Line Loop(ill5) = {-ilc10,ilc6,ilc3}; ilruls5=newreg; Ruled Surface(ilruls5) = {ill5};
|
||||
ill6 = newreg; Line Loop(ill6) = {-ilc11,-ilc3,ilc7}; ilruls6=newreg; Ruled Surface(ilruls6) = {ill6};
|
||||
ill7 = newreg; Line Loop(ill7) = {-ilc2,-ilc7,-ilc12};ilruls7=newreg; Ruled Surface(ilruls7) = {ill7};
|
||||
ill8 = newreg; Line Loop(ill8) = {-ilc6,-ilc9,ilc2}; ilruls8=newreg; Ruled Surface(ilruls8) = {ill8};
|
||||
|
||||
ilsloop0 = newreg;
|
||||
Surface Loop(ilsloop0) = {ill8+1,ill5+1,ill1+1,ill2+1,ill3+1,ill7+1,ill6+1,ill4+1};
|
||||
|
||||
|
||||
// 2.3.3 Define volume of air sphere
|
||||
|
||||
vil1=newv; Volume(vil1) = {ilsloop0};
|
||||
|
||||
|
||||
// 3.0 define physical entitites
|
||||
|
||||
Physical Point(vacuum_background_bnd) = {ilp1,ilp2,ilp3,ilp4,ilp5,ilp6,ilp7};
|
||||
Physical Surface(vacuum_background_bnd) = {ilruls1,ilruls2,ilruls3,ilruls4,ilruls5,ilruls6,ilruls7,ilruls8};
|
||||
Physical Volume(air) = {vil1};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,375 @@
|
||||
// rights - 2006-, copyright patrick leidenberger and benedikt oswald,
|
||||
// all rights reserved
|
||||
// project - gmsh2h5fed
|
||||
// file name - gmsh.cc
|
||||
// file type - c++ implementation file
|
||||
// objective - implement class for readind gmsh data files
|
||||
// modified - 2006 aug 24, creation, patrick leidenberger
|
||||
// modified - 2006 aug 26, pl, Access to private members.
|
||||
|
||||
#include "gmsh.hh"
|
||||
|
||||
using namespace boost::spirit;
|
||||
using namespace gmshtohdf5fed;
|
||||
using namespace rlog;
|
||||
using namespace std;
|
||||
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/iterator/file_iterator.hpp>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "gmshgrammar.hh"
|
||||
#include "gmshsemanticaction.hh"
|
||||
|
||||
|
||||
gmsh::gmsh()
|
||||
{
|
||||
//rDebug("Enter vtk constructor.");
|
||||
// Clean the gmsh data structure.
|
||||
gmshNodes_.clear();
|
||||
gmshNodesNumber_.clear();
|
||||
gmshLine_.clear();
|
||||
gmshLineTag_.clear();
|
||||
gmshTriangle_.clear();
|
||||
gmshTriangleTag_.clear();
|
||||
gmshQuadrangle_.clear();
|
||||
gmshQuadrangleTag_.clear();
|
||||
gmshTetrahedron_.clear();
|
||||
gmshTetrahedronTag_.clear();
|
||||
gmshHexahedron_.clear();
|
||||
gmshHexahedronTag_.clear();
|
||||
gmshPrism_.clear();
|
||||
gmshPrismTag_.clear();
|
||||
gmshPyramid_.clear();
|
||||
gmshPyramidTag_.clear();
|
||||
gmsh2ndLineTag_.clear();
|
||||
gmsh2ndTriangle_.clear();
|
||||
gmsh2ndTriangleTag_.clear();
|
||||
gmsh2ndQuadrangle_.clear();
|
||||
gmsh2ndQuadrangleTag_.clear();
|
||||
gmsh2ndTetrahedron_.clear();
|
||||
gmsh2ndTetrahedronTag_.clear();
|
||||
gmsh2ndHexahedron_.clear();
|
||||
gmsh2ndHexahedronTag_.clear();
|
||||
gmsh2ndPrism_.clear();
|
||||
gmsh2ndPrismTag_.clear();
|
||||
gmsh2ndPyramid_.clear();
|
||||
gmsh2ndPyramidTag_.clear();
|
||||
gmshPoint_.clear();
|
||||
gmshPointTag_.clear();
|
||||
//rDebug("Leafe vtk constructor.");
|
||||
}
|
||||
|
||||
gmsh::~gmsh()
|
||||
{
|
||||
//rDebug("Enter vtk destructor.");
|
||||
//rDebug("Leafe vtk destructor.");
|
||||
}
|
||||
|
||||
|
||||
int gmsh::gmshFileName(char* fileName)
|
||||
{
|
||||
//rDebug("Enter fileName.");
|
||||
// Erase the fileName_.
|
||||
fileName_.erase();
|
||||
// Copy fileName in private string fileName_.
|
||||
gmshCpString(fileName, &fileName_);
|
||||
// rDebug("fileName_= %s",fileName_.c_str());
|
||||
//rDebug("Leafe fileName");
|
||||
return OKCODE;
|
||||
}
|
||||
int gmsh::gmshFileName(string fileName)
|
||||
{
|
||||
//rDebug("Enter fileName.");
|
||||
// Erase the fileName_.
|
||||
fileName_.erase();
|
||||
// Copy fileName in private string fileName_.
|
||||
fileName_ = fileName;
|
||||
// rDebug("fileName_= %s",fileName_.c_str());
|
||||
//rDebug("Leafe fileName");
|
||||
}
|
||||
|
||||
|
||||
int gmsh::gmshOpen(void)
|
||||
{
|
||||
//rDebug("Enter openVtk.");
|
||||
|
||||
// Open a stream to read the gmsh file in a string.
|
||||
ifstream inFile (fileName_.c_str());
|
||||
|
||||
// Check if file was opened corretly.
|
||||
if (! inFile)
|
||||
{
|
||||
rError("Cannot open file %s.", fileName_.c_str());
|
||||
return ERRORCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rInfo("Open file %s", fileName_.c_str());
|
||||
|
||||
// Read file content into a string
|
||||
fileContent.erase();
|
||||
char chr;
|
||||
while (inFile.get(chr))
|
||||
{
|
||||
fileContent.append(1,chr);
|
||||
}
|
||||
rInfo(" File has been read.");
|
||||
//rDebug("Input file:\n%s",fileContent.c_str());
|
||||
// Close input file.
|
||||
inFile.close();
|
||||
rInfo(" File Closed.");
|
||||
return OKCODE;
|
||||
}
|
||||
//rDebug("Leave openVtk.");
|
||||
}
|
||||
|
||||
|
||||
int gmsh::gmshParseFile(gmsh* gmshSelf)
|
||||
{
|
||||
//rDebug("Enter parseFile.");
|
||||
|
||||
// Provide an instance of the grammar describing the gmsh file format.
|
||||
stack<long> gmshStack;
|
||||
// Our vtk parser.
|
||||
// Give the parser a pointer to the instance of the gmsh class. So we can
|
||||
// call member functions as semantic action.
|
||||
gmsh_g gmsh_p(gmshSelf);
|
||||
|
||||
// Call the parser.
|
||||
parse_info <iterator_t> info = parse(fileContent.c_str(),gmsh_p,space_p);
|
||||
|
||||
// Feedback to user on parsing outcome.
|
||||
if (info.full)
|
||||
{
|
||||
rInfo("-------------------------");
|
||||
rInfo("parsing succeeded :-)");
|
||||
rInfo("-------------------------");
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
ostringstream temp;
|
||||
temp << info.stop ;
|
||||
rError("-------------------------");
|
||||
rError("parsing failed :-(");
|
||||
rError("stopped at line: %s", temp.str().c_str());
|
||||
rError("-------------------------");
|
||||
return ERRORCODE;
|
||||
}
|
||||
|
||||
//rDebug("Leave parseFile.");
|
||||
}
|
||||
|
||||
int gmsh::gmshPushNode(vector<double>* nodeCoords)
|
||||
{
|
||||
//rDebug("gmshPushNode(vector<double>* nodeCoords).");
|
||||
gmshNodes_.push_back(*nodeCoords);
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
int gmsh::gmshPushNodeNumber(unsigned int* nodeNumber)
|
||||
{
|
||||
gmshNodesNumber_.push_back(*nodeNumber);
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
int gmsh::gmshPushElem(unsigned short int elemType,
|
||||
vector<unsigned int>* nodeVector)
|
||||
{
|
||||
//rDebug("Inside gmshPushElem.");
|
||||
if (elemType == GMSH_LINE)
|
||||
gmshLine_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_TRIANGLE)
|
||||
gmshTriangle_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_QUADRANGLE)
|
||||
gmshQuadrangle_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_TETRAHEDRON)
|
||||
gmshTetrahedron_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_HEXAHEDRON)
|
||||
gmshHexahedron_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_PRISM)
|
||||
gmshPrism_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_PYRAMID)
|
||||
gmshPyramid_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_LINE)
|
||||
gmsh2ndLine_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_TRIANGLE)
|
||||
gmsh2ndTriangle_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_QUADRANGLE)
|
||||
gmsh2ndQuadrangle_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_TETRAHEDRON)
|
||||
gmsh2ndTetrahedron_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_HEXAHEDRON)
|
||||
gmsh2ndHexahedron_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_PRISM)
|
||||
gmsh2ndPrism_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_2ND_PYRAMID)
|
||||
gmsh2ndPyramid_.push_back(*nodeVector);
|
||||
else if (elemType == GMSH_POINT)
|
||||
gmshPoint_.push_back(*nodeVector);
|
||||
else
|
||||
{
|
||||
rError("A unknown element type found!");
|
||||
rError("Element type: %d", elemType);
|
||||
}
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
int gmsh::gmshPushTag(unsigned short int elemType,
|
||||
vector<unsigned int>* tagVector)
|
||||
{
|
||||
//rDebug("Inside gmshPushElem.");
|
||||
if (elemType == GMSH_LINE)
|
||||
{
|
||||
//rDebug(" Line pushedback");
|
||||
}
|
||||
else if (elemType == GMSH_TRIANGLE)
|
||||
{
|
||||
//rDebug(" Triangle pushedback");
|
||||
}
|
||||
else if (elemType == GMSH_QUADRANGLE)
|
||||
{
|
||||
//rDebug(" Quadrangle pushedback");
|
||||
}
|
||||
else if (elemType == GMSH_TETRAHEDRON)
|
||||
{
|
||||
//rDebug(" Tetrahedron pushedback");
|
||||
gmshTetrahedronTag_.push_back(*tagVector);
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
|
||||
int gmsh::gmshShowElemResult()
|
||||
{
|
||||
rInfo("Elements found in gmsh file:");
|
||||
rInfo(" lines: %d",gmshLine_.size());
|
||||
rInfo(" triangles: %d",gmshTriangle_.size());
|
||||
rInfo(" quadrangles: %d",gmshQuadrangle_.size());
|
||||
rInfo(" tetrahedrons: %d",gmshTetrahedron_.size());
|
||||
rInfo(" hexahedrons: %d",gmshHexahedron_.size());
|
||||
rInfo(" prisms: %d",gmshPrism_.size());
|
||||
rInfo(" pyramids: %d",gmshPyramid_.size());
|
||||
rInfo(" 2nd order lines: %d",gmsh2ndLine_.size());
|
||||
rInfo(" 2nd order Triangles: %d",gmsh2ndTriangle_.size());
|
||||
rInfo(" 2nd order Quadrangles: %d",gmsh2ndQuadrangle_.size());
|
||||
rInfo(" 2nd order Tetrahedrons: %d",gmsh2ndTetrahedron_.size());
|
||||
rInfo(" 2nd order Hexahedrons: %d",gmsh2ndHexahedron_.size());
|
||||
rInfo(" 2nd order Prisms: %d",gmsh2ndPrism_.size());
|
||||
rInfo(" 2nd order Pyramids: %d",gmsh2ndPyramid_.size());
|
||||
rInfo(" Points : %d",gmshPoint_.size());
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
void gmsh::cpString(char const* first,
|
||||
char const* last,
|
||||
string* str)
|
||||
{
|
||||
//rDebug("Enter cpString.");
|
||||
|
||||
// Erase the str content.
|
||||
str->erase();
|
||||
|
||||
// Copy version in str.
|
||||
for(unsigned int i = 0; i<strlen(first)-strlen(last); i++)
|
||||
{
|
||||
str->append(1,first[i]);
|
||||
}
|
||||
//rDebug("*str= %s",str->c_str());
|
||||
|
||||
//rDebug("Leafe cpString.");
|
||||
}
|
||||
string gmsh::cpString(char const* first,
|
||||
char const* last)
|
||||
{
|
||||
//rDebug("Enter cpString.");
|
||||
|
||||
// Create and erase a tempral string;
|
||||
string tempString;
|
||||
tempString.erase();
|
||||
|
||||
// Copy version in str.
|
||||
for(unsigned int i = 0; i<strlen(first)-strlen(last); i++)
|
||||
{
|
||||
tempString.append(1,first[i]);
|
||||
}
|
||||
//rDebug("tempString= %s",tempString.c_str());
|
||||
//rDebug("Leafe cpString.");
|
||||
return tempString;
|
||||
}
|
||||
|
||||
int gmsh::gmshCpString(char const* first,
|
||||
string*str)
|
||||
{
|
||||
// Create and erase a tempral string;
|
||||
std::string tempString;
|
||||
tempString.erase();
|
||||
// Copy the character sign for sign into the string.
|
||||
for(unsigned int i = 0; i<strlen(first); i++)
|
||||
{
|
||||
tempString.append(1,first[i]);
|
||||
}
|
||||
//rDebug("tempString= %s",tempString.c_str());
|
||||
//rDebug("Leafe cpString.");
|
||||
return OKCODE;
|
||||
}
|
||||
|
||||
int gmsh::gmshCheckVersion(int* version)
|
||||
{
|
||||
if ((int)(*version) == 2)
|
||||
{
|
||||
rInfo("Gmsh file has format 2.");
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("Gmsh file has format: %d.", (int)(*version));
|
||||
rError("But this program can only read format 2.");
|
||||
rError("Exit");
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
}
|
||||
|
||||
int gmsh::gmshCheckFileType(int* fileType)
|
||||
{
|
||||
if ((int)(*fileType) == 0)
|
||||
{
|
||||
rInfo("Gmsh file has ascii format.");
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("Gmsh file has format: %d.", (int)(*fileType));
|
||||
rError("But this program can only read format 0 (ascii).");
|
||||
rError("Exit");
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
}
|
||||
|
||||
std::vector< std::vector <double> > gmsh::gmshNode()
|
||||
{
|
||||
return gmshNodes_;
|
||||
}
|
||||
|
||||
std::vector<unsigned int> gmsh::gmshNodeNumber()
|
||||
{
|
||||
return gmshNodesNumber_;
|
||||
}
|
||||
|
||||
std::vector< std::vector<unsigned int> > gmsh::gmshTetrahedron()
|
||||
{
|
||||
return gmshTetrahedron_;
|
||||
}
|
||||
|
||||
std::vector< std::vector<unsigned int> > gmsh::gmshTetrahedronTag()
|
||||
{
|
||||
return gmshTetrahedronTag_;
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
// rights - 2006-, copyright patrick leidenberger and benedikt oswald,
|
||||
// all rights reserved
|
||||
// project - gmsh2h5fed
|
||||
// file name - gmsh.hh
|
||||
// file type - c++ header file
|
||||
// objective - declare class for readind gmsh mesh files v2.0
|
||||
//
|
||||
// modified - 2006 aug 21, creation, Patrick Leidenberger
|
||||
// modified - 2006 aug 22, pl.
|
||||
// modified - 2006 aug 23, pl.
|
||||
// modified - 2006 aug 24, pl, delete old things.
|
||||
// modified - 2006 aug 26, pl, Access to private members.
|
||||
|
||||
#ifndef GMSH_HH_
|
||||
#define GMSH_HH_
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/iterator/file_iterator.hpp>
|
||||
#include <boost/spirit/core.hpp>
|
||||
|
||||
/* Include the files for rlog. */
|
||||
#include <rlog/rlog.h>
|
||||
#include <rlog/rloglocation.h>
|
||||
#include <rlog/Error.h>
|
||||
#include <rlog/RLogChannel.h>
|
||||
#include <rlog/StdioNode.h>
|
||||
#include <rlog/RLogTime.h>
|
||||
|
||||
#include <nonsciconst.h>
|
||||
|
||||
// Include gmsh specific constants.
|
||||
#include "gmshconst.hh"
|
||||
|
||||
using namespace std;
|
||||
using namespace nonsciconst;
|
||||
|
||||
namespace gmshtohdf5fed
|
||||
{
|
||||
class gmsh
|
||||
{
|
||||
public:
|
||||
// Constructor: Here we clear all private data vectors.
|
||||
gmsh();
|
||||
// Destructor.
|
||||
~gmsh();
|
||||
|
||||
int gmshFileName(char* fileName);
|
||||
int gmshFileName(string fileName);
|
||||
|
||||
int gmshOpen(void);
|
||||
|
||||
int gmshParseFile(gmsh* vtkSelf);
|
||||
|
||||
void cpString(char const* first,
|
||||
char const* last,
|
||||
string* str);
|
||||
string cpString(char const* first,
|
||||
char const* last);
|
||||
|
||||
int gmshCpString(char const* first,
|
||||
string*str);
|
||||
// Check if gmsh file is of version 2.
|
||||
int gmshCheckVersion(int* version);
|
||||
// Check if the gmsh file is in ascii format.
|
||||
int gmshCheckFileType(int* fileType);
|
||||
|
||||
// Pushes the three coordinates of a node in the gmshNodes_ vector.
|
||||
int gmshPushNode(vector<double>* nodeCoords);
|
||||
|
||||
// Pushes the number of a node in the gmshNodesNumber_ vector.
|
||||
int gmshPushNodeNumber(unsigned int * nodeNumber);
|
||||
|
||||
// Push the node vector nodeVector to the appropriate data structure
|
||||
// denoted by the string.
|
||||
int gmshPushElem(unsigned short int elemType,
|
||||
vector<unsigned int>* nodeVector);
|
||||
// Push the tag vector tagVector to the appropriate data structure
|
||||
// denoted by the string.
|
||||
int gmshPushTag(unsigned short int elemType,
|
||||
vector<unsigned int>* tagVector);
|
||||
// Show the size of the element vectors.
|
||||
int gmshShowElemResult();
|
||||
|
||||
//-------------------------------------//
|
||||
// Access to private stored gmsh data. //
|
||||
//-------------------------------------//
|
||||
|
||||
std::vector< std::vector <double> > gmshNode();
|
||||
std::vector<unsigned int> gmshNodeNumber();
|
||||
std::vector< std::vector<unsigned int> > gmshTetrahedron();
|
||||
std::vector< std::vector<unsigned int> > gmshTetrahedronTag();
|
||||
|
||||
private:
|
||||
string fileName_;
|
||||
string fileContent;
|
||||
|
||||
// Data structure for node coordinates from gmsh file.
|
||||
vector<vector<double> > gmshNodes_;
|
||||
// Data structure for gmsh node number.
|
||||
// A number belongs to the respective node coordinate in the gmshNodes_
|
||||
// vector.
|
||||
vector<unsigned int> gmshNodesNumber_;
|
||||
|
||||
// Data structure for the topological entities and their tags stored in
|
||||
// the gmsh file. The 'gmsh2nd..' denote second order Elements.
|
||||
vector<vector<unsigned int> > gmshLine_;
|
||||
vector<vector<unsigned int> > gmshLineTag_;
|
||||
vector<vector<unsigned int> > gmshTriangle_;
|
||||
vector<vector<unsigned int> > gmshTriangleTag_;
|
||||
vector<vector<unsigned int> > gmshQuadrangle_;
|
||||
vector<vector<unsigned int> > gmshQuadrangleTag_;
|
||||
vector<vector<unsigned int> > gmshTetrahedron_;
|
||||
vector<vector<unsigned int> > gmshTetrahedronTag_;
|
||||
vector<vector<unsigned int> > gmshHexahedron_;
|
||||
vector<vector<unsigned int> > gmshHexahedronTag_;
|
||||
vector<vector<unsigned int> > gmshPrism_;
|
||||
vector<vector<unsigned int> > gmshPrismTag_;
|
||||
vector<vector<unsigned int> > gmshPyramid_;
|
||||
vector<vector<unsigned int> > gmshPyramidTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndLine_;
|
||||
vector<vector<unsigned int> > gmsh2ndLineTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndTriangle_;
|
||||
vector<vector<unsigned int> > gmsh2ndTriangleTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndQuadrangle_;
|
||||
vector<vector<unsigned int> > gmsh2ndQuadrangleTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndTetrahedron_;
|
||||
vector<vector<unsigned int> > gmsh2ndTetrahedronTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndHexahedron_;
|
||||
vector<vector<unsigned int> > gmsh2ndHexahedronTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndPrism_;
|
||||
vector<vector<unsigned int> > gmsh2ndPrismTag_;
|
||||
vector<vector<unsigned int> > gmsh2ndPyramid_;
|
||||
vector<vector<unsigned int> > gmsh2ndPyramidTag_;
|
||||
vector<vector<unsigned int> > gmshPoint_;
|
||||
vector<vector<unsigned int> > gmshPointTag_;
|
||||
};
|
||||
}
|
||||
|
||||
#endif //GMSH_HH_
|
||||
@@ -0,0 +1,28 @@
|
||||
#ifndef GMSHCONST_HH_
|
||||
#define GMSHCONST_HH_
|
||||
|
||||
// Contants of gmsh element types.
|
||||
// See Gmsh Reference Manual (14 May 2006) page 147-148.
|
||||
const unsigned short int GMSH_LINE = 1;
|
||||
const unsigned short int GMSH_TRIANGLE = 2;
|
||||
const unsigned short int GMSH_QUADRANGLE = 3;
|
||||
const unsigned short int GMSH_TETRAHEDRON = 4;
|
||||
const unsigned short int GMSH_HEXAHEDRON = 5;
|
||||
const unsigned short int GMSH_PRISM = 6;
|
||||
const unsigned short int GMSH_PYRAMID = 7;
|
||||
const unsigned short int GMSH_2ND_LINE = 8;
|
||||
const unsigned short int GMSH_2ND_TRIANGLE = 9;
|
||||
const unsigned short int GMSH_2ND_QUADRANGLE = 10;
|
||||
const unsigned short int GMSH_2ND_TETRAHEDRON = 11;
|
||||
const unsigned short int GMSH_2ND_HEXAHEDRON = 12;
|
||||
const unsigned short int GMSH_2ND_PRISM = 13;
|
||||
const unsigned short int GMSH_2ND_PYRAMID = 14;
|
||||
const unsigned short int GMSH_POINT = 15;
|
||||
|
||||
// Every element has an spesific number of tags.
|
||||
// This is the list of the number. There is a leading zero, because there is
|
||||
// no element with the index 0.
|
||||
const unsigned short int GMSH_ELEM_N_NODES[] = { 0, 2, 3, 4, 4, 8, 6, 5, 3,
|
||||
6, 9, 10, 27, 18, 14, 1 };
|
||||
|
||||
#endif //GMSHCONST_HH_
|
||||
@@ -0,0 +1,242 @@
|
||||
/** \brief Definition of gmsh file format v2.0 parser data types and variables
|
||||
*
|
||||
* rights - patrick leidenberger and benedikt oswald
|
||||
* file name - gmshgrammar.hh
|
||||
* file type - include file
|
||||
* objective - define grammar of gmsh file format v2.0
|
||||
* author - patrick leidenberger and benedikt oswald
|
||||
* modified - 2006 jun 29, pl, creation
|
||||
* features - defines grammar of gmsh files v2.0
|
||||
*/
|
||||
|
||||
/* include standard header files */
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/iterator/file_iterator.hpp>
|
||||
#include <boost/spirit/actor/assign_actor.hpp>
|
||||
#include <boost/spirit/utility/functor_parser.hpp>
|
||||
#include <boost/spirit/utility/escape_char.hpp>
|
||||
#include <boost/spirit/utility/loops.hpp>
|
||||
#include <boost/spirit/dynamic/if.hpp>
|
||||
#include <iostream>
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <stack>
|
||||
#include <string>
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/ref.hpp>
|
||||
|
||||
/* include proprietary header files */
|
||||
#include "gmshsemanticaction.hh"
|
||||
#include "gmsh.hh"
|
||||
// Include gmsh specific constants.
|
||||
#include "gmshconst.hh"
|
||||
|
||||
#ifndef GMSHGRAMMAR_HH_
|
||||
#define GMSHGRAMMAR_HH_
|
||||
|
||||
/* activate namespaces */
|
||||
using namespace std;
|
||||
using namespace boost::spirit;
|
||||
using namespace gmshtohdf5fed;
|
||||
|
||||
/* type definitions */
|
||||
//typedef char char_t;
|
||||
//typedef file_iterator<char_t> iterator_t;
|
||||
//typedef scanner<iterator_t> scanner_t;
|
||||
//typedef rule<scanner_t> rule_t;
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Our calculator grammar
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
struct gmsh_g : public grammar<gmsh_g>
|
||||
{
|
||||
// vtk_g(/*stack<long>& eval_*/)
|
||||
// /*: eval(eval_)*/ {}
|
||||
gmsh_g(gmsh* gmshSelf)
|
||||
: gmshSelf_(gmshSelf)
|
||||
{
|
||||
}
|
||||
|
||||
template <typename ScannerT>
|
||||
struct definition
|
||||
{
|
||||
definition(gmsh_g const& self)
|
||||
{
|
||||
gmsh_import_r = gmsh_mesh_format_r
|
||||
>> gmsh_nodes_r
|
||||
>> gmsh_elements_r;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// GENERAL NOTE: All tranport of numbers to gmshsemanticaction.hh must //
|
||||
// be done by reference, not by value. Transport by //
|
||||
// value fails! You have to debug long for it! //
|
||||
/////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Rules for the MeshFormat section.
|
||||
gmsh_mesh_format_r = str_p("$MeshFormat")
|
||||
>> int_p[assign_a(tempInt1_)]
|
||||
[gmsh_version_a(self.gmshSelf_, &tempInt1_)]
|
||||
>> int_p[assign_a(tempInt1_)]
|
||||
[gmsh_file_type_a(self.gmshSelf_, &tempInt1_)]
|
||||
>> int_p[assign_a(tempInt1_)]
|
||||
>> str_p("$EndMeshFormat");
|
||||
|
||||
// Rules for the Nodes section.
|
||||
gmsh_nodes_r = str_p("$Nodes")
|
||||
>> eps_p[gmsh_clear_map_a<unsigned int,
|
||||
vector<double> >(&tempCoordMap_)]
|
||||
>> int_p[assign_a(tempUnInt1_)]
|
||||
>> eps_p[gmsh_info_msg_a("Nodes in gmsh file: ",
|
||||
&tempUnInt1_)]
|
||||
>> repeat_p(boost::ref(tempUnInt1_))
|
||||
[
|
||||
eps_p[gmsh_clear_vec_a<double>(&tempVecDouble1_)]
|
||||
>> int_p[assign_a(tempUnInt2_)]
|
||||
>> repeat_p(3)
|
||||
[real_p[assign_a(tempDouble1_)]
|
||||
[gmsh_push_vec_a<double>(&tempVecDouble1_,
|
||||
&tempDouble1_)]
|
||||
]
|
||||
[gmsh_insert_map_a<unsigned int,
|
||||
vector<double> >
|
||||
(&tempCoordMap_, &tempUnInt2_,
|
||||
&tempVecDouble1_)
|
||||
]
|
||||
]
|
||||
>> str_p("$EndNodes")
|
||||
>> eps_p[gmsh_transport_nodes_a(self.gmshSelf_,
|
||||
&tempCoordMap_)];
|
||||
|
||||
// Rules for the Elements section.
|
||||
gmsh_elements_r = str_p("$Elements")
|
||||
>> int_p[assign_a(tempUnInt1_)]
|
||||
>> eps_p[gmsh_info_msg_a("Elements in gmsh file: ",
|
||||
&tempUnInt1_)]
|
||||
>> gmsh_element_r
|
||||
>> str_p("$EndElements");
|
||||
|
||||
gmsh_element_r = repeat_p(boost::ref(tempUnInt1_))
|
||||
[ // Parse one element
|
||||
// Clear the vectors for nodes and tags of an elem.
|
||||
eps_p[gmsh_clear_vec_a<unsigned int>
|
||||
(&tempElemNode_)]
|
||||
>> eps_p[gmsh_clear_vec_a<unsigned int>
|
||||
(&tempElemTag_)]
|
||||
// Parse the element number. We don't need it.
|
||||
>> int_p[assign_a(tempUnInt2_)]
|
||||
// Parse the element type.
|
||||
>> int_p[assign_a(tempUnShortInt1_)]
|
||||
// Parse the number of tags.
|
||||
>> int_p[assign_a(tempUnInt3_)]
|
||||
// Parse the tags.
|
||||
>> repeat_p(boost::ref(tempUnInt3_))
|
||||
[
|
||||
// Parse a single tag.
|
||||
int_p[assign_a(tempUnInt4_)]
|
||||
// Copy to vector.
|
||||
>> eps_p[gmsh_push_vec_a<unsigned int>
|
||||
(&tempElemTag_, &tempUnInt4_)]
|
||||
][gmsh_nothing_a()]
|
||||
// Copy the number of nodes of the actual element
|
||||
// type (in tempUnShortInt1_) from the
|
||||
// GMSH_ELEM_N_NODES array in gmshconst.hh in
|
||||
// tempUnShortInt2_.
|
||||
// Do this, because I don't get the direct array
|
||||
// access not work.
|
||||
>> eps_p[gmsh_array_access_a<unsigned short int>
|
||||
(&tempUnShortInt2_, &tempUnShortInt1_)]
|
||||
// Parse the respective number of nodes.
|
||||
>> repeat_p(boost::ref(tempUnShortInt2_))
|
||||
[
|
||||
// Parse a sigle node.
|
||||
int_p[assign_a(tempUnInt4_)]
|
||||
// Copy to vector.
|
||||
>> eps_p[gmsh_push_vec_a<unsigned int>
|
||||
(&tempElemNode_, &tempUnInt4_)]
|
||||
|
||||
]
|
||||
[
|
||||
// Transport the parsed element nodes in the
|
||||
// respective gmsh.hh data structure.
|
||||
gmsh_transport_elem_a(self.gmshSelf_,
|
||||
&tempUnShortInt1_, &tempElemNode_)
|
||||
]
|
||||
[
|
||||
// Transport the parsed element tags in the
|
||||
// respective gmsh.hh data structure.
|
||||
gmsh_transport_tag_a(self.gmshSelf_,
|
||||
&tempUnShortInt1_, &tempElemTag_)
|
||||
]
|
||||
// This short section demonstrates, like con-
|
||||
// ditional parsing can be used instead:
|
||||
//
|
||||
//>> if_p(gmsh_compare_a<unsigned short int>
|
||||
// (&tempUnShortInt1_,&(elemType_[0])))
|
||||
// [
|
||||
// // Element type 1 == line.
|
||||
// repeat_p(2)
|
||||
// [
|
||||
// int_p[assign_a(tempUnInt4_)]
|
||||
// ][gmsh_nothing_a()]
|
||||
// ]
|
||||
//
|
||||
]
|
||||
[
|
||||
// All elements are parsed.
|
||||
// Show what we have paresd.
|
||||
gmsh_show_elem_result_a(self.gmshSelf_)
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
rule<ScannerT> expression, term, factor, integer;
|
||||
|
||||
|
||||
rule<ScannerT> vtk_import_r;
|
||||
|
||||
rule<ScannerT> gmsh_import_r;
|
||||
rule<ScannerT> gmsh_mesh_format_r;
|
||||
rule<ScannerT> gmsh_nodes_r;
|
||||
rule<ScannerT> gmsh_elements_r;
|
||||
rule<ScannerT> gmsh_element_r;
|
||||
|
||||
rule<ScannerT> const&
|
||||
start() const { return gmsh_import_r; }
|
||||
|
||||
// These are temporal variables used during the parsing process.
|
||||
// These variables are used at different places for different things,
|
||||
// they are only valid in small ranges.
|
||||
int tempInt1_;
|
||||
unsigned int tempUnInt1_;
|
||||
unsigned int tempUnInt2_;
|
||||
unsigned int tempUnInt3_;
|
||||
unsigned int tempUnInt4_;
|
||||
unsigned short int tempUnShortInt1_;
|
||||
unsigned short int tempUnShortInt2_;
|
||||
|
||||
double tempDouble1_;
|
||||
|
||||
vector<int> tempIntVec1_;
|
||||
vector<double> tempDoubleVec1_;
|
||||
vector<vector<double> > tempDoubleVec2_;
|
||||
|
||||
vector<double> tempVecDouble1_;
|
||||
|
||||
// Data structure for node coordinates.
|
||||
// The gmsh node coordinates are not stored and numbered consecutive. So we
|
||||
// have to sort and map them to a consecutive index set using this map.
|
||||
map<unsigned int, vector<double> > tempCoordMap_;
|
||||
// Data structure to store the nodes of an element.
|
||||
vector<unsigned int> tempElemNode_;
|
||||
// Data structure to store an elements tags.
|
||||
vector<unsigned int> tempElemTag_;
|
||||
|
||||
};
|
||||
|
||||
gmsh* gmshSelf_;
|
||||
};
|
||||
|
||||
#endif // GMSHGRAMMAR_HH_
|
||||
@@ -0,0 +1,344 @@
|
||||
// rights - 2006-, copyright benedikt oswald and patrick leidenberger,
|
||||
// all rights reserved
|
||||
/** \brief Definition of VTK ASCII file format parser
|
||||
* project - phidias3d
|
||||
* file name - vtksemanticaction.h
|
||||
* file type - c++ include file
|
||||
* objective - declare semantic action for the vtk file parser
|
||||
* modified - 2006 jul 03, creation, pl
|
||||
* modified - 2006 jul 05, insert fuctionality of calling member functions
|
||||
* of the vtk class, pl
|
||||
* modified - 2006 jul 06, Add actions for vtk file header and file format.
|
||||
* modified - 2006 jul 11, Add a lot of action to store the unstructured
|
||||
* grid dataset. This section is complete.
|
||||
* modified - 2006 jul 13, Make the action work well: it is not a good idea
|
||||
* to transport pointers or strings! Use pointers of
|
||||
* characters.
|
||||
* modified - 2006 aug 27, Correct error in pushNode function, pl.
|
||||
**/
|
||||
|
||||
|
||||
/* include standard header files */
|
||||
#include <boost/spirit/core.hpp>
|
||||
#include <boost/spirit/iterator/file_iterator.hpp>
|
||||
#include <iostream>
|
||||
//#include <iterator>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <functional>
|
||||
#include <stack>
|
||||
#include "gmsh.hh"
|
||||
|
||||
/* include proprietary header files */
|
||||
//#include "ansyscnx.h"
|
||||
|
||||
/* activate namespaces */
|
||||
using namespace std;
|
||||
using namespace boost;
|
||||
using namespace boost::spirit;
|
||||
//using namespace phidias3d;
|
||||
|
||||
using namespace gmshtohdf5fed;
|
||||
|
||||
|
||||
/* type definitions */
|
||||
typedef char char_t;
|
||||
typedef file_iterator<char_t> iterator_t;
|
||||
typedef scanner<iterator_t> scanner_t;
|
||||
typedef rule<scanner_t> rule_t;
|
||||
|
||||
#ifndef GMSHSEMANTICACTION_HH_
|
||||
#define GMSHSEMANTICACTION_HH_
|
||||
|
||||
/* semantic actions */
|
||||
|
||||
// Call version-check of gmsh file.
|
||||
struct gmsh_version_a
|
||||
{
|
||||
gmsh_version_a(gmsh* gmshSelf, int* tempInt)
|
||||
: gmshSelf_(gmshSelf), tempInt_(tempInt) {}
|
||||
void operator()(int value) const
|
||||
{
|
||||
//rDebug("Inside gmsh_version_a.");
|
||||
gmshSelf_->gmshCheckVersion(tempInt_);
|
||||
};
|
||||
gmsh* gmshSelf_;
|
||||
int* tempInt_;
|
||||
};
|
||||
|
||||
struct gmsh_file_type_a
|
||||
{
|
||||
gmsh_file_type_a(gmsh* gmshSelf, int* tempInt)
|
||||
: gmshSelf_(gmshSelf), tempInt_(tempInt) {}
|
||||
void operator()(int value) const
|
||||
{
|
||||
//rDebug("Inside gmsh_version_a.");
|
||||
gmshSelf_->gmshCheckFileType(tempInt_);
|
||||
};
|
||||
gmsh* gmshSelf_;
|
||||
int* tempInt_;
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
struct gmsh_clear_vec_a
|
||||
{
|
||||
gmsh_clear_vec_a(vector<Type>* vect)
|
||||
: vect_(vect) {}
|
||||
void operator()(char const* first, char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug("Clear temporal vector.");
|
||||
(*vect_).clear();
|
||||
};
|
||||
vector<Type>* vect_;
|
||||
};
|
||||
|
||||
template<typename type>
|
||||
struct gmsh_resize_vec_a
|
||||
{
|
||||
gmsh_resize_vec_a(vector<type>* vec, unsigned int size)
|
||||
: vec_(vec), size_(size) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug("Inside gmsh_resize_vec_a.");
|
||||
(*vec_).resize(size_);
|
||||
};
|
||||
void operator() (const int tempInt)
|
||||
const
|
||||
{
|
||||
//rDebug("Inside gmsh_resize_vec_a.");
|
||||
(*vec_).resize(size_);
|
||||
};
|
||||
unsigned int size_;
|
||||
vector<type> * vec_;
|
||||
};
|
||||
|
||||
template<typename type>
|
||||
struct gmsh_insert_vec_a
|
||||
{
|
||||
gmsh_insert_vec_a(vector<type>* vec, unsigned int const position,
|
||||
type* value)
|
||||
: vec_(vec), position_(position), value_(value) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
(*vec_)[position_]=*value_;
|
||||
}
|
||||
vector<type> * vec_;
|
||||
unsigned int position_;
|
||||
type* value_;
|
||||
};
|
||||
|
||||
|
||||
template<typename type>
|
||||
struct gmsh_push_vec_a
|
||||
{
|
||||
gmsh_push_vec_a(vector<type>* vec, type* value)
|
||||
: vec_(vec), value_(value){}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug(" Push value to vector.");
|
||||
(*vec_).push_back(*value_);
|
||||
};
|
||||
void operator() (const double tempDouble)
|
||||
const
|
||||
{
|
||||
//rDebug(" Push value to vector.");
|
||||
(*vec_).push_back(*value_);
|
||||
};
|
||||
type* value_;
|
||||
vector<type> * vec_;
|
||||
};
|
||||
|
||||
|
||||
template<typename type1, typename type2>
|
||||
struct gmsh_insert_map_a
|
||||
{
|
||||
gmsh_insert_map_a(map<type1, type2>* tempMap, type1* key,
|
||||
type2* value)
|
||||
: map_(tempMap), key_(key), value_(value) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
(*map_)[(*key_)]=*value_;
|
||||
};
|
||||
map<type1, type2> * map_;
|
||||
type1* key_;
|
||||
type2* value_;
|
||||
};
|
||||
|
||||
template<typename type1, typename type2>
|
||||
struct gmsh_clear_map_a
|
||||
{
|
||||
gmsh_clear_map_a(map<type1, type2>* tempMap)
|
||||
: map_(tempMap) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
(*map_).clear();
|
||||
};
|
||||
map<type1, type2> * map_;
|
||||
};
|
||||
|
||||
|
||||
struct gmsh_transport_nodes_a
|
||||
{
|
||||
gmsh_transport_nodes_a(gmsh* gmshSelf,
|
||||
map<unsigned int, vector<double> >* tempMap)
|
||||
: gmshSelf_(gmshSelf), map_(tempMap) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug("Copy nodes in data structure.");
|
||||
for (map<unsigned int, vector<double> >::iterator
|
||||
iter = (*map_).begin(); iter != (*map_).end(); iter++)
|
||||
{
|
||||
vector<double>* temp;
|
||||
unsigned int tempNumber;
|
||||
temp = &((*iter).second);
|
||||
tempNumber = ((*iter).first);
|
||||
gmshSelf_->gmshPushNode(temp);
|
||||
gmshSelf_->gmshPushNodeNumber(&tempNumber);
|
||||
//rDebug("%f %f %f", (*temp)[0], (*temp)[1], (*temp)[2]);
|
||||
}
|
||||
|
||||
};
|
||||
map<unsigned int, vector<double> >* map_;
|
||||
gmsh* gmshSelf_;
|
||||
};
|
||||
|
||||
|
||||
|
||||
struct gmsh_transport_elem_a
|
||||
{
|
||||
gmsh_transport_elem_a(gmsh* gmshSelf, unsigned short int* elemType,
|
||||
vector <unsigned int>* tempElemNode)
|
||||
: gmshSelf_(gmshSelf), elemType_(elemType), tempElemNode_(tempElemNode) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug("Copy element type %d in data structure.", *elemType_);
|
||||
gmshSelf_->gmshPushElem(*elemType_, tempElemNode_);
|
||||
};
|
||||
gmsh* gmshSelf_;
|
||||
unsigned short int* elemType_;
|
||||
vector <unsigned int>* tempElemNode_;
|
||||
};
|
||||
|
||||
|
||||
struct gmsh_transport_tag_a
|
||||
{
|
||||
gmsh_transport_tag_a(gmsh* gmshSelf, unsigned short int* elemType,
|
||||
vector <unsigned int>* tempElemTag)
|
||||
: gmshSelf_(gmshSelf), elemType_(elemType), tempElemTag_(tempElemTag) {}
|
||||
void operator() (char const* first,char const* last)
|
||||
const
|
||||
{
|
||||
//rDebug("Copy element tag list in data structure.");
|
||||
gmshSelf_->gmshPushTag(*elemType_, tempElemTag_);
|
||||
};
|
||||
gmsh* gmshSelf_;
|
||||
unsigned short int* elemType_;
|
||||
vector <unsigned int>* tempElemTag_;
|
||||
};
|
||||
|
||||
|
||||
// Print actions.
|
||||
struct gmshEMsg_a
|
||||
{
|
||||
gmshEMsg_a(string gmshEMsg, unsigned int* tempUnLongInt)
|
||||
: gmshEMsg_(gmshEMsg), tempUnLongInt_(tempUnLongInt) {}
|
||||
void operator()(char const* first, char const* last)
|
||||
const
|
||||
{
|
||||
rError("%s %d",gmshEMsg_.c_str(),(*tempUnLongInt_));
|
||||
};
|
||||
string gmshEMsg_;
|
||||
unsigned int* tempUnLongInt_;
|
||||
};
|
||||
|
||||
struct gmsh_info_msg_a
|
||||
{
|
||||
gmsh_info_msg_a(string gmsh_info_msg)
|
||||
: gmsh_info_msg_(gmsh_info_msg), tempUnLongInt_(NULL), tempUnShortInt_(NULL) {}
|
||||
gmsh_info_msg_a(string gmsh_info_msg, unsigned int* tempUnLongInt)
|
||||
: gmsh_info_msg_(gmsh_info_msg), tempUnLongInt_(tempUnLongInt), tempUnShortInt_(NULL) {}
|
||||
gmsh_info_msg_a(string gmsh_info_msg, unsigned short int* tempUnShortInt)
|
||||
: gmsh_info_msg_(gmsh_info_msg), tempUnLongInt_(NULL), tempUnShortInt_(tempUnShortInt) {}
|
||||
void operator()(char const* first, char const* last)
|
||||
const
|
||||
{
|
||||
if ((tempUnLongInt_ == NULL) && (tempUnShortInt_ == NULL))
|
||||
rInfo("%s",gmsh_info_msg_.c_str());
|
||||
else if ((tempUnLongInt_ != NULL) && (tempUnShortInt_ == NULL))
|
||||
rInfo("%s%d",gmsh_info_msg_.c_str(),(*tempUnLongInt_));
|
||||
else if ((tempUnLongInt_ == NULL) && (tempUnShortInt_ != NULL))
|
||||
rInfo("%s%d",gmsh_info_msg_.c_str(),(*tempUnShortInt_));
|
||||
};
|
||||
string gmsh_info_msg_;
|
||||
unsigned int* tempUnLongInt_;
|
||||
unsigned short int* tempUnShortInt_;
|
||||
};
|
||||
|
||||
struct gmsh_nothing_a
|
||||
{
|
||||
gmsh_nothing_a()
|
||||
{}
|
||||
void operator()(char const* first, char const* last)
|
||||
const
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template<typename type>
|
||||
struct gmsh_compare_a
|
||||
{
|
||||
gmsh_compare_a(type* a, type* b)
|
||||
: a_(a), b_(b) {}
|
||||
bool operator () () const
|
||||
{
|
||||
if (*a_ == *b_)
|
||||
{
|
||||
//rDebug("Return TRUE! a = %d b = %d", *a_, *b_);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//rDebug("Return FALSE! a = %d b = %d", *a_, *b_);
|
||||
return false;
|
||||
}
|
||||
};
|
||||
type* a_;
|
||||
type* b_;
|
||||
};
|
||||
|
||||
template<typename type>
|
||||
struct gmsh_array_access_a
|
||||
{
|
||||
gmsh_array_access_a(type* a, type* b)
|
||||
: a_(a), b_(b) {}
|
||||
void operator()(char const* first, char const* last) const
|
||||
{
|
||||
*a_ = GMSH_ELEM_N_NODES[*b_];
|
||||
};
|
||||
type* a_;
|
||||
type* b_;
|
||||
};
|
||||
|
||||
|
||||
struct gmsh_show_elem_result_a
|
||||
{
|
||||
gmsh_show_elem_result_a(gmsh* gmshSelf)
|
||||
: gmshSelf_(gmshSelf) {}
|
||||
void operator()(char const* first, char const* last)
|
||||
const
|
||||
{
|
||||
gmshSelf_->gmshShowElemResult();
|
||||
};
|
||||
gmsh* gmshSelf_;
|
||||
};
|
||||
|
||||
#endif // GMSHSEMANTICACTION_HH_
|
||||
@@ -0,0 +1,18 @@
|
||||
## Makefile.am -- process this file with automake to produce Makefile.in
|
||||
##
|
||||
## authors - benedikt oswald and patrick leidenberger
|
||||
## modified - 2006 aug 21, patrick leidenberger, creation
|
||||
## modified - 2006 aug 23, pl, adaped to new directory structure.
|
||||
#
|
||||
## objective - automake input file for the gmsh directory
|
||||
## project - gmshtohdf5fed
|
||||
|
||||
noinst_LTLIBRARIES = libgmsh.la
|
||||
gmshdir = $(topleveldir)/libsrc/gmsh
|
||||
gmsh_HEADERS = gmsh.hh
|
||||
libgmsh_la_SOURCES = gmsh.cc \
|
||||
gmsh.hh \
|
||||
gmshconst.hh \
|
||||
gmshgrammer.hh \
|
||||
gmshsemanticaction.hh
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
@@ -0,0 +1,37 @@
|
||||
// rights - 2006-, copyright benedikt, all rights reserved
|
||||
// project - phidias3d
|
||||
// file name - hdf5em.h
|
||||
// file type - c++ implementation file
|
||||
// objective - implement class for HDF5/ELECTROMAGNETIC file format access
|
||||
// modified - 2006 jun 26, creation, benedikt oswald
|
||||
// modified - 2006
|
||||
// inheritance -
|
||||
// feature - implements the base class for HDF5/ELECTROMAGNETIC file format access.
|
||||
// feature -
|
||||
// required software -
|
||||
|
||||
|
||||
/* include standard header files */
|
||||
//#include <h5.h>
|
||||
|
||||
|
||||
|
||||
/* include proprietary files */
|
||||
#include "h5fed.hh"
|
||||
#ifdef HAVE_HDF5
|
||||
|
||||
namespace hdf5em
|
||||
{
|
||||
//
|
||||
// hdf5em::hdf5em()
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
// hdf5em::~hdf5em()
|
||||
// {
|
||||
// ;
|
||||
// }
|
||||
//
|
||||
}
|
||||
#endif // HAVE_HDF5
|
||||
@@ -0,0 +1,658 @@
|
||||
// rights - 2006-, copyright benedikt, all rights reserved
|
||||
// project - phidias3d
|
||||
// file name - hdf5em.h
|
||||
// file type - c++ header file
|
||||
// objective - declare class for HDF5/ELECTROMAGNETIC file format access
|
||||
// modified - 2006 jun 26, creation, benedikt oswald
|
||||
// modified - 2006 aug 26, pl, integrate automatic index mapping.
|
||||
// inheritance -
|
||||
// feature - declares the base class for HDF5/ELECTROMAGNETIC file format access;
|
||||
// feature - this class is completely self contained, i.e. it does not need anything
|
||||
// feature - external, except the STL and the HDF5 header files and the corresponding
|
||||
// feature - library.
|
||||
// required software -
|
||||
|
||||
#ifndef H5FED_HH_
|
||||
#define H5FED_HH_
|
||||
|
||||
#ifdef HAVE_HDF5
|
||||
|
||||
/* include standard header files */
|
||||
#include <cmath>
|
||||
#include <iostream>
|
||||
#include <complex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
// Include the files for rlog.
|
||||
#include <rlog/rlog.h>
|
||||
#include <rlog/rloglocation.h>
|
||||
#include <rlog/Error.h>
|
||||
#include <rlog/RLogChannel.h>
|
||||
#include <rlog/StdioNode.h>
|
||||
#include <rlog/RLogTime.h>
|
||||
|
||||
// Include HDF5 headers.
|
||||
#include <hdf5.h>
|
||||
|
||||
// Include h5fed specific constants.
|
||||
#include "h5fedconst.hh"
|
||||
|
||||
/* include standard proprietary header files */
|
||||
#include "nonsciconst.h"
|
||||
#include "physicomath.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace physicomath;
|
||||
using namespace nonsciconst;
|
||||
|
||||
namespace H5Fed
|
||||
{
|
||||
|
||||
class H5Fed {
|
||||
public:
|
||||
/** \brief constructor and destructor */
|
||||
H5Fed()
|
||||
{
|
||||
doIndexMapping_ = false;
|
||||
indexMap_.clear();
|
||||
positionMap_.clear();
|
||||
|
||||
// Deactivate the HDF5 error output.
|
||||
H5Eset_auto (0, NULL );
|
||||
};
|
||||
|
||||
// The Destructor.
|
||||
~H5Fed(){};
|
||||
|
||||
|
||||
//! Open an hdf5 finite element data file with appropriate access.
|
||||
int open(string fileName, string fileAccess)
|
||||
{
|
||||
// Store filename and file access in private variable.
|
||||
fileName_ = fileName;
|
||||
fileAccess_ = fileAccess;
|
||||
// Open file with respective rights via HDF5 API.
|
||||
if (!fileAccess_.compare(FILE_READ))
|
||||
{
|
||||
hdf5FileIdent_ = H5Fopen(fileName_.c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
return OKCODE;
|
||||
}
|
||||
else if (!fileAccess_.compare(FILE_READ_WRITE))
|
||||
{
|
||||
hdf5FileIdent_ = H5Fopen(fileName_.c_str(), H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
return OKCODE;
|
||||
}
|
||||
else if (!fileAccess_.compare(FILE_CREATE))
|
||||
{
|
||||
hdf5FileIdent_ = H5Fcreate(fileName_.c_str(), H5F_ACC_EXCL,
|
||||
H5P_DEFAULT, H5P_DEFAULT);
|
||||
if (hdf5FileIdent_ < 0)
|
||||
{
|
||||
rError("The file %s already exist.",fileName_.c_str());
|
||||
rError("To overwrite use the --force option.");
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
else
|
||||
return OKCODE;
|
||||
}
|
||||
else if (!fileAccess_.compare(FILE_CREATE_FORCE))
|
||||
{
|
||||
hdf5FileIdent_ = H5Fcreate(fileName_.c_str(), H5F_ACC_TRUNC,
|
||||
H5P_DEFAULT, H5P_DEFAULT);
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("Unknown file-open-attribute for hdf5 file.");
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
};
|
||||
|
||||
// Close an open hdf5 file.
|
||||
int close(void)
|
||||
{
|
||||
if (hdf5FileIdent_ >= 0)
|
||||
{
|
||||
hdf5Status_ = H5Fclose(hdf5FileIdent_);
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("You cannot close a file that is not opened.");
|
||||
return ERRORCODE;
|
||||
}
|
||||
};
|
||||
|
||||
// Create the empty HDF5 Finite Element Stardart group hierarchy.
|
||||
int createGroupHierarchie()
|
||||
{
|
||||
// Hdf5 group identifier for group access, localy valid (this method).
|
||||
hid_t hdf5GroupIdent_;
|
||||
// Create the groups. All group-name strings are defined in h5fedconst.hh.
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_ROOT.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_COORD.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_VOLUME_MESH.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_BOUNDARY_MESH.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_MATERIAL.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_ELECTROMAGNETIC.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_DISCRETE.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_PHYSICAL.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_DEBYE.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_LORENTZ.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_DRUDE.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_DOF.c_str(),H5P_DEFAULT);
|
||||
hdf5GroupIdent_ = H5Gcreate(hdf5FileIdent_,
|
||||
H5FED_G_FIELD.c_str(),H5P_DEFAULT);
|
||||
return OKCODE;
|
||||
};
|
||||
|
||||
// This function activate the automatic index mapping to create a gapfree
|
||||
// and consecutive index set for the hdf5fed file.
|
||||
// The indexVec holdes the numbers of the nodes in the same way, as the
|
||||
// nodes are in the node vector.
|
||||
int beginIndexMapping(std::vector<unsigned int>* indexVec)
|
||||
{
|
||||
rDebug("Begin automatic index mapping.");
|
||||
doIndexMapping_ = true;
|
||||
indexMap_.clear();
|
||||
positionMap_.clear();
|
||||
|
||||
// Copy the old index to the map as map-key.
|
||||
for(unsigned int varI = 0; varI < indexVec->size(); varI++)
|
||||
{
|
||||
indexMap_.insert(make_pair((*indexVec)[varI],0));
|
||||
}
|
||||
// Number all elements in the map consecutive, starting with zero, that
|
||||
// is the new index set.
|
||||
unsigned int tempUnInt = 0;
|
||||
for(std::map<unsigned int, unsigned int>::iterator
|
||||
iter = indexMap_.begin();
|
||||
iter != indexMap_.end(); iter ++)
|
||||
{
|
||||
iter->second = tempUnInt;
|
||||
tempUnInt++;
|
||||
}
|
||||
// The first column contains the new index, the second the old position
|
||||
// of the coordinate in the vector.
|
||||
for(unsigned int varI = 0; varI < indexVec->size(); varI++)
|
||||
{
|
||||
positionMap_.insert(make_pair(
|
||||
(indexMap_.find((*indexVec)[varI]))->second,varI));
|
||||
}
|
||||
return OKCODE;
|
||||
};
|
||||
|
||||
// This function deactivate the automatic index mapping.
|
||||
// The uses index sets must be consecutive and gapfree.
|
||||
int endIndexMapping()
|
||||
{
|
||||
rDebug("End automatic index mapping.");
|
||||
doIndexMapping_ = false;
|
||||
indexMap_.clear();
|
||||
return OKCODE;
|
||||
};
|
||||
|
||||
// Write 3dim coordinates to h5fed file.
|
||||
int coord3d (std::vector<std::vector<double> >* coord)
|
||||
{
|
||||
// All these operations are only allowed, if there is a valid file
|
||||
// identifier.
|
||||
if (hdf5FileIdent_ >= 0)
|
||||
{
|
||||
// Define the rank of the different dataspaces.
|
||||
const int rank = 2;
|
||||
// Hdf5 error handling variable for Hdf5 actions.
|
||||
herr_t hdf5Status;
|
||||
// Hdf5 dataspace identifier.
|
||||
hid_t hdf5DataspaceId;
|
||||
// Hdf5 dataset identifier.
|
||||
hid_t hdf5DatasetId;
|
||||
// Define the dimension of the data array.
|
||||
// Number of rows: as much as coordinates.
|
||||
// Number of colums: 3, one for each dimension.
|
||||
hsize_t dim[2];
|
||||
dim[0] = coord->size();
|
||||
dim[1] = 3;
|
||||
|
||||
// We copy the coordinates from coord in an standart array, so that
|
||||
// hdf5 can handle it.
|
||||
// We do this in portions, so we save memory.
|
||||
|
||||
// Subdimension of hyperslab in memory: 1 line, 3 columns.
|
||||
hsize_t dim_sub_mem[2];
|
||||
dim_sub_mem[0] = 1;
|
||||
dim_sub_mem[1] = 3;
|
||||
// Subdimension of hyperslab in file: 1 line, 3 columns.
|
||||
hsize_t dim_sub_file[2];
|
||||
dim_sub_file[0] = 1;
|
||||
dim_sub_file[1] = 3;
|
||||
// Define the offset for reading from the memory.
|
||||
// Always fixed.
|
||||
hsize_t offset_mem[2];
|
||||
offset_mem[0] = 0;
|
||||
offset_mem[1] = 0;
|
||||
// Define the offset for writing into the file.
|
||||
hsize_t offset_file[2];
|
||||
offset_file[0] = 0; // Row only at the beginning. We iterate over it.
|
||||
offset_file[1] = 0; // We have no offset respective to the column.
|
||||
|
||||
// Array for x, y and z component of one coordinate.
|
||||
double coordinate[3];
|
||||
|
||||
// Dimesion and datatype of the file dataset, read out form file.
|
||||
// This is not the fastest, but the most robust way.
|
||||
hsize_t dim_out[2];
|
||||
hid_t dataType;
|
||||
|
||||
|
||||
// Create dataspace of full size.
|
||||
hdf5DataspaceId = H5Screate_simple(rank, dim, H5P_DEFAULT);
|
||||
|
||||
// Create dataset of full size.
|
||||
hdf5DatasetId = H5Dcreate(hdf5FileIdent_, H5FED_D_COORD3D.c_str(),
|
||||
H5T_IEEE_F64LE, hdf5DataspaceId, H5P_DEFAULT);
|
||||
|
||||
|
||||
|
||||
// Loop over all rows of the dataset (file) and copy the coord vector
|
||||
// element wise.
|
||||
hdf5Status = H5Sget_simple_extent_dims(hdf5DataspaceId, dim_out, H5P_DEFAULT);
|
||||
dataType = H5Dget_type(hdf5DatasetId);
|
||||
// If we use automatic mapping we need an interator to the map.
|
||||
std::map<unsigned int, unsigned int>::iterator
|
||||
iter = positionMap_.begin();
|
||||
for (unsigned int varI = 0; varI < dim_out[0]; varI++)
|
||||
{
|
||||
// Iterate over the rows in file dataspace.
|
||||
offset_file[0] = varI;
|
||||
|
||||
// Copy every element of a coordinate.
|
||||
for (unsigned int varJ = 0; varJ < dim_out[1]; varJ++)
|
||||
{
|
||||
// Here is the only special case for automated mapping:
|
||||
// Do not copy the next in the input vector, copy the coord
|
||||
// with the next following number.
|
||||
if (doIndexMapping_ == true)
|
||||
coordinate[varJ] = (*coord)[iter->second][varJ];
|
||||
else
|
||||
coordinate[varJ] = (*coord)[varI][varJ];
|
||||
}
|
||||
|
||||
// Select hyperslab ('region') in file dataspace.
|
||||
hdf5Status = H5Sselect_hyperslab(hdf5DataspaceId, H5S_SELECT_SET,
|
||||
offset_file, H5P_DEFAULT,
|
||||
dim_sub_file, H5P_DEFAULT);
|
||||
|
||||
// Define memory Dataspace.
|
||||
hid_t hdf5MemspaceId;
|
||||
hdf5MemspaceId = H5Screate_simple(rank, dim_sub_mem, H5P_DEFAULT);
|
||||
// Select hyperslab ('region') in memory.
|
||||
hdf5Status = H5Sselect_hyperslab(hdf5MemspaceId, H5S_SELECT_SET,
|
||||
offset_mem, H5P_DEFAULT,
|
||||
dim_sub_mem, H5P_DEFAULT);
|
||||
|
||||
// Copy dataset to dataset from memory to file.
|
||||
hdf5Status = H5Dwrite(hdf5DatasetId, H5T_NATIVE_DOUBLE,
|
||||
hdf5MemspaceId, hdf5DataspaceId,
|
||||
H5P_DEFAULT, coordinate);
|
||||
|
||||
H5Sclose(hdf5MemspaceId);
|
||||
// Increment the map iterator if we make automatic mapping.
|
||||
if (doIndexMapping_)
|
||||
iter++;
|
||||
}
|
||||
|
||||
// Close hdf5 identifier.
|
||||
hdf5Status = H5Dclose(hdf5DatasetId);
|
||||
hdf5Status = H5Sclose(hdf5DataspaceId);
|
||||
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("You cannot operate to dataset COORD3D.");
|
||||
rError("There is no valid file identifier.");
|
||||
return ERRORCODE;
|
||||
}
|
||||
};
|
||||
|
||||
// Read and return tetrahedron on of the given level.
|
||||
std::vector<std::vector<unsigned int> > tetrahedron(unsigned int level)
|
||||
{
|
||||
rError("The function: tetrahedron(unsigned int level) is not implemented.");
|
||||
};
|
||||
// Copy the tetrahedon elements to the h5fed file.
|
||||
int tetrahedron(unsigned int level,
|
||||
std::vector< std::vector<unsigned int> >* elem)
|
||||
{
|
||||
// Set dimension of an elements vector.
|
||||
unsigned int elemDim = H5FED_TET_N_NODE;
|
||||
// Set the name of the dataset, we want to operate.
|
||||
string datasetName = H5FED_D_TETMESH + stringify(level);
|
||||
// This function does the real work for all elements.
|
||||
element_(level, elem, datasetName, elemDim);
|
||||
return OKCODE;
|
||||
|
||||
}
|
||||
|
||||
int element_(unsigned int level,
|
||||
std::vector< std::vector<unsigned int> >* elem,
|
||||
std::string datasetName,
|
||||
unsigned int elemDim )
|
||||
{
|
||||
// All these operations are only allowed, if there is a valid file
|
||||
// identifier.
|
||||
if (hdf5FileIdent_ >= 0)
|
||||
{
|
||||
rDebug("Insert a check, if the selected level exits,");
|
||||
rDebug("and if it is consecutive.");
|
||||
// Define the rank of the different dataspaces.
|
||||
const int rank = 2;
|
||||
// Hdf5 error handling variable for Hdf5 actions.
|
||||
herr_t hdf5Status;
|
||||
// Hdf5 dataspace identifier.
|
||||
hid_t hdf5DataspaceId;
|
||||
// Hdf5 dataset identifier.
|
||||
hid_t hdf5DatasetId;
|
||||
// Define the dimension of the data array.
|
||||
hsize_t dim[2];
|
||||
// Number of rows: as much as elements.
|
||||
dim[0] = elem->size();
|
||||
// Number of colums: dimenstion of an elements vector.
|
||||
dim[1] = elemDim;
|
||||
|
||||
// We copy the element nodes from a element in an standart array,
|
||||
// so that hdf5 can handle it.
|
||||
// We do this for every element separate, so we save memory.
|
||||
|
||||
// Subdimension of hyperslab in memory: 1 line, elemDim columns.
|
||||
hsize_t dim_sub_mem[2];
|
||||
dim_sub_mem[0] = 1;
|
||||
dim_sub_mem[1] = elemDim;
|
||||
// Subdimension of hyperslab in file: 1 line, elemDim columns.
|
||||
hsize_t dim_sub_file[2];
|
||||
dim_sub_file[0] = 1;
|
||||
dim_sub_file[1] = elemDim;
|
||||
// Define the offset for reading from the memory.
|
||||
// Always fixed, because memory has exactly the same size.
|
||||
hsize_t offset_mem[2];
|
||||
offset_mem[0] = 0;
|
||||
offset_mem[1] = 0;
|
||||
// Define the offset for writing into the file.
|
||||
hsize_t offset_file[2];
|
||||
offset_file[0] = 0; // Row ofsett zero only at the beginning.
|
||||
offset_file[1] = 0; // We have no offset respective to the column.
|
||||
|
||||
// Array for single elements of an element vector.
|
||||
unsigned int element[elemDim];
|
||||
|
||||
// Dimesion and datatype of the file dataset, read out form file.
|
||||
// This is not the fastest, but the most robust way.
|
||||
hsize_t dim_out[2];
|
||||
hid_t dataType;
|
||||
|
||||
// Create dataspace of full size.
|
||||
hdf5DataspaceId = H5Screate_simple(rank, dim, H5P_DEFAULT);
|
||||
|
||||
// Create dataset of full size.
|
||||
hdf5DatasetId = H5Dcreate(hdf5FileIdent_, datasetName.c_str(),
|
||||
H5T_STD_U32LE, hdf5DataspaceId, H5P_DEFAULT);
|
||||
|
||||
// Loop over all rows of the dataset (file) and copy the elem vector
|
||||
// row wise.
|
||||
hdf5Status = H5Sget_simple_extent_dims(hdf5DataspaceId, dim_out,
|
||||
H5P_DEFAULT);
|
||||
// Get the datatype of the datas we want to write.
|
||||
dataType = H5Dget_type(hdf5DatasetId);
|
||||
for (unsigned int varI = 0; varI < dim_out[0]; varI++)
|
||||
{
|
||||
// Iterate over the rows in file dataspace.
|
||||
offset_file[0] = varI;
|
||||
|
||||
// Copy every element of a coordinate.
|
||||
for (unsigned int varJ = 0; varJ < dim_out[1]; varJ++)
|
||||
{
|
||||
// Here is the only special case for automated mapping:
|
||||
// Do not copy the next in the input vector, copy the coord
|
||||
// with the next following number.
|
||||
if (doIndexMapping_ == true)
|
||||
{
|
||||
std::map<unsigned int, unsigned int>::iterator iter;
|
||||
iter = indexMap_.find((*elem)[varI][varJ]);
|
||||
element[varJ] = iter->second;
|
||||
}
|
||||
else
|
||||
element[varJ] = (*elem)[varI][varJ];
|
||||
}
|
||||
|
||||
// Select hyperslab ('region') in file dataspace.
|
||||
hdf5Status = H5Sselect_hyperslab(hdf5DataspaceId, H5S_SELECT_SET,
|
||||
offset_file, H5P_DEFAULT,
|
||||
dim_sub_file, H5P_DEFAULT);
|
||||
// Define memory Dataspace.
|
||||
hid_t hdf5MemspaceId;
|
||||
hdf5MemspaceId = H5Screate_simple(rank, dim_sub_mem, H5P_DEFAULT);
|
||||
// Select hyperslab ('region') in memory.
|
||||
hdf5Status = H5Sselect_hyperslab(hdf5MemspaceId, H5S_SELECT_SET,
|
||||
offset_mem, H5P_DEFAULT,
|
||||
dim_sub_mem, H5P_DEFAULT);
|
||||
// Copy dataset to dataset from memory to file.
|
||||
hdf5Status = H5Dwrite(hdf5DatasetId, dataType,
|
||||
hdf5MemspaceId, hdf5DataspaceId,
|
||||
H5P_DEFAULT, element);
|
||||
// Close the memory space identifier.
|
||||
H5Sclose(hdf5MemspaceId);
|
||||
}
|
||||
|
||||
// Close hdf5 identifier.
|
||||
hdf5Status = H5Dclose(hdf5DatasetId);
|
||||
hdf5Status = H5Sclose(hdf5DataspaceId);
|
||||
|
||||
return OKCODE;
|
||||
}
|
||||
else
|
||||
{
|
||||
rError("You cannot operate to a dataset.");
|
||||
rError("There is no valid file identifier.");
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/** \brief Inquire existence of HDF5 groups */
|
||||
// existsVolumeMesh()
|
||||
// existsCoord()
|
||||
// virtual bool existsMesh(){ return(false); }
|
||||
// virtual bool existsVertices(){ return(false); }
|
||||
// virtual bool existsEdges(){ return(false); }
|
||||
// virtual bool existsTriangles(){ return(false); }
|
||||
// virtual bool existsBoundaryTriangles(){ return(false); }
|
||||
|
||||
// /** \brief Data access both reading and writing */
|
||||
// virtual unsigned int nDim(){ return(ndim_); } /* retrieve number of mesh dimension */
|
||||
// virtual unsigned int nLevel(){ return(nlevel_); } /* retrieve number of mesh levels */
|
||||
// virtual unsigned int nCoord(){ return(nvertex_); } /* retrieve total number of all vertices */
|
||||
// virtual unsigned int nCoord(unsigned int level){ return(nvertex_); } /* retrieve total number of vertices used for defining the mesh */
|
||||
// Überladen greifen auf nelem zu
|
||||
// virtual std::vector<unsigned int> nTet(){ return(ntet_); } /* retrieve vector containing number of tetrahedra present in levels of the mesh */
|
||||
// virtual std::vector<unsigned int> nBoundary(){ return(nboundary_); } /* retrieve vector containing number of boundary meshes present on a level of the mesh */
|
||||
// Pism, ...
|
||||
// nBoundaryTriangle
|
||||
// Quad..
|
||||
// Edge
|
||||
|
||||
|
||||
/** \brief HDF5EM data access routines */
|
||||
|
||||
/** \brief Electromagnetic boundary conditions */
|
||||
//_______________________________
|
||||
// virtual int triangleBC(unsigned int level, unsigned int triangle, unsigned int bc){} /* set electromagnetic boundary condition for triangle on level */
|
||||
// virtual unsigned int triangleBC(unsigned int level, unsigned int triangle){} /* retrieve electromagnetic boundary condition type */
|
||||
//
|
||||
// virtual int rhoSurfaceImpedance(unsigned int level, unsigned int triangle, double rho){} /* store resistance of surface impedance for triangle on level */
|
||||
// virtual double rhoSurfaceImpedance(unsigned int level, unsigned int triangle){} /* retrieve resistance of surface impedance boundary condition */
|
||||
//
|
||||
// /** \brief Mesh */
|
||||
// stl vectoren
|
||||
// virtual unsigned int** tetrahedron(unsigned int level){} /* read tetrahedra on level l stored in hdf5 file and return them in simple form */
|
||||
// virtual int tetrahedron(unsigned int level, unsigned int ntetrahedron, unsigned int** tetrahedron){}
|
||||
// virtual unsigned int* vertexId(){} /* read identification tag of vertices */
|
||||
//
|
||||
// virtual double** vertex(unsigned int level){} /* read vertices */
|
||||
// virtual int vertex(unsigned int nvertex, double** vertex){} /* write vertices */
|
||||
//
|
||||
// virtual unsigned int** boundary(unsigned int level, unsigned int wboundary){} /* read boundary meshes stored in the hdf5 file on level and return number of them */
|
||||
// virtual int boundary(unsigned int level, unsigned int** boundary, unsigned int wboundary){} /* write whichboundary boundary mesh into file */
|
||||
//
|
||||
// virtual unsigned int** edge(unsigned int level, aqmedge* &edge){} /* read edges on level and return number of them */
|
||||
// virtual int edge(unsigned int level, unsigned int* edge){} /* write edges on level and return number of them */
|
||||
//
|
||||
// virtual unsigned int** triangle(unsigned int level){} /* read Triangular faces on level */
|
||||
// virtual int triangle(unsigned int level, unsigned int** triangle){} /* write Triangular faces on level */
|
||||
//
|
||||
// /** \brief Materials */
|
||||
// bool existsMaterials() /* find out if there are materials parameters at discrete frequencies, energies or wavelength */
|
||||
//
|
||||
// vector<double> frequency(){} /* read a vector of discrete frequencies stored in the file */
|
||||
// int frequency(vector<double> f){} /* store a vector of discrete frequencies into the file */
|
||||
//
|
||||
// vector<double> energy(){} /* read a vector of discrete energies stored in the file */
|
||||
// int energy(vector<double> e){} /* store a vector of discrete wavelengths into the file */
|
||||
//
|
||||
// vector<double> wavelength(){} /* read a vector of discrete wavelengths stored in the file */
|
||||
// int wavelength(vector<double> lambda){} /* store a vector of discrete wavelengths into the file */
|
||||
//
|
||||
// vector< complex<double> > permittivity(){} /* read a vector of complex valued relative permittivities from the file */
|
||||
// int permittivity( vector< complex<double> > epsilonr){} /* store a vector of complex valued relative permittivities into the file */
|
||||
//
|
||||
// vector< complex<double> > permeability(){} /* read a vector of complex valued relative permittivities from the file */
|
||||
// int permeability( vector< complex<double> > mur){} /* store a vector of complex valued relative permittivities into the file */
|
||||
//
|
||||
// vector< complex<double> > conductivity(){} /* read a vector of complex valued relative permittivities from the file */
|
||||
// int conductivity( vector< complex<double> sigma>){} /* store a vector of complex valued relative permittivities into the file */
|
||||
//
|
||||
// /** \brief Materials */
|
||||
// bool existsDebyeMaterial(){} /* are the Debye material model paramters */
|
||||
// bool existsLorentz(){} /* are there Lorentz material model parameters */
|
||||
// bool existsDrudeMaterial(){} /* are there Drude material model parameters */
|
||||
//
|
||||
// /* Debye dielectric material model parameters, cf. Taflove et al. pp. 354 */
|
||||
// std<double> weightsDebye(){} /* retrieve vector of Debye material model weights */
|
||||
// int weightsDebye(vector<double> weightsdebye){} /* store vector of Debye material model weights */
|
||||
//
|
||||
// std<double> relaxationFrequencyDebye(){} /* retrieve vector of Debye material model relaxation frequencies */
|
||||
// int relaxationFrequencyDebye(vector<double> relaxfreq){} /* retrieve vector of Debye material model relaxation frequencies */
|
||||
//
|
||||
// double epsilonStaticDebye(){} /* retrieve static limit of relative permittivitiye */
|
||||
// int epsilonStaticDebye(double epsilonstaticr){} /* store static limit of relative permittivitiye */
|
||||
//
|
||||
// double epsilonInfinityDebye(){} /* retrieve infinite limit of relative permittivity */
|
||||
// int epsilonInfinityDebye(double epsiloninftyr){} /* store infinite limit of relative permittivity */
|
||||
//
|
||||
// /* Lorentz dielectric material model parameters, cf. Taflove et al. pp. 354 */
|
||||
// std<double> weightsLorentz(){} /* retrieve vector of Debye material model weights */
|
||||
// int weightsLorentz(vector<double> weightsdebye){} /* store vector of Debye material model weights */
|
||||
//
|
||||
// std<double> poleFrequencyLorentz(){} /* retrieve vector of Lorentz material model relaxation frequencies */
|
||||
// int poleFrequencyDebye(vector<double> polefreq){} /* retrieve vector of Lorentz material model relaxation frequencies */
|
||||
//
|
||||
// std<double> dampingCoefficientLorentz(){} /* retrieve vector of Lorentz material model damping coefficients */
|
||||
// int dampingCoefficientLorentz(vector<double> dampingcoeff){} /* retrieve vector of Lorentz material model damping coefficients */
|
||||
//
|
||||
// double epsilonStaticLorentz(){} /* retrieve static limit of relative permittivitiye */
|
||||
// int epsilonStaticLorentz(double epsilonstaticr){} /* store static limit of relative permittivitiye */
|
||||
//
|
||||
// double epsilonInfinityLorentz(){} /* retrieve infinite limit of relative permittivity */
|
||||
// int epsilonInfinityLorentz(double epsiloninftyr){} /* store infinite limit of relative permittivity */
|
||||
//
|
||||
// /* Drude dielectric material model parameters, cf. Taflove et al. pp. 354 */
|
||||
// std<double> weightsDrude(){} /* retrieve vector of Drude material model weights */
|
||||
// int weightsDrude(vector<double> weightsdebye){} /* store vector of Drude material model weights */
|
||||
//
|
||||
// std<double> poleFrequencyDrude(){} /* retrieve vector of Drude material model pole frequencies */
|
||||
// int poleFrequencyDrude(vector<double> relaxfreq){} /* retrieve vector of Drude material model pole frequencies */
|
||||
//
|
||||
// std<double> inversePoleRelaxationTimeDrude(){} /* retrieve vector of Lorentz material model inverse pole relaxation time */
|
||||
// int inversePoleRelaxationTimeDrude(vector<double> inversepolerelaxtime){} /* retrieve vector of Lorentz material model inverse pole relaxation time */
|
||||
//
|
||||
// double epsilonStaticDrude(){} /* retrieve static limit of relative permittivitiye */
|
||||
// int epsilonStaticDrude(double epsilonstaticr){} /* store static limit of relative permittivitiye */
|
||||
//
|
||||
// double epsilonInfinityDrude(){} /* retrieve infinite limit of relative permittivity */
|
||||
// int epsilonInfinityDRude(double epsiloninftyr){} /* store infinite limit of relative permittivity */
|
||||
//________________________________________________________________
|
||||
// protected:
|
||||
//
|
||||
|
||||
private:
|
||||
//-----------------------------------------------------------------------//
|
||||
// Private data structure. //
|
||||
//-----------------------------------------------------------------------//
|
||||
// Store the filename of the H5Fed here.
|
||||
string fileName_;
|
||||
// Store the file access rights of the H5Fed here.
|
||||
string fileAccess_;
|
||||
|
||||
// Hdf5 error variable stores the success of an Hdf5 action.
|
||||
herr_t hdf5Status_;
|
||||
// Hdf5 file identifier for file access. If a file access fails, the
|
||||
// identifyer is negetive.
|
||||
hid_t hdf5FileIdent_;
|
||||
|
||||
// If the elements we want to write to the h5fed file are not consecutive
|
||||
// and with gaps numbered, this API shoud be able to map this to an gapfree
|
||||
// and consecutive index set.
|
||||
// To activate this function we have the following variable.
|
||||
bool doIndexMapping_;
|
||||
// The first entry in indexMap_ is the old index of a coordinate, the
|
||||
// second is the new index usend in the h5fed file.
|
||||
std::map<unsigned int, unsigned int> indexMap_;
|
||||
// The first entry in positionMap_ is the new index usend in the h5fed
|
||||
// file, the second is the old postion in the coordinate vector.
|
||||
std::map<unsigned int, unsigned int> positionMap_;
|
||||
|
||||
//-----------------------------------------------------------------------//
|
||||
// Private helper functions. //
|
||||
//-----------------------------------------------------------------------//
|
||||
// This function converts a number to a string.
|
||||
template<typename type>
|
||||
inline std::string stringify(type value)
|
||||
{
|
||||
std::ostringstream oStream;
|
||||
try
|
||||
{
|
||||
oStream << value;
|
||||
}
|
||||
catch(exception& error)
|
||||
{
|
||||
rError("Cannot convert this variable to a string.");
|
||||
rError("Error: %d",error.what());
|
||||
exit(ERRORCODE);
|
||||
}
|
||||
return oStream.str();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
} // End of namespace H5Fed
|
||||
|
||||
|
||||
#endif // HAVE_HDF5
|
||||
#endif //H5FED_HH_
|
||||
@@ -0,0 +1,50 @@
|
||||
#ifndef H5FEDCONST_HH_
|
||||
#define H5FEDCONST_HH_
|
||||
|
||||
#include<string>
|
||||
using namespace std;
|
||||
|
||||
//! Hdf5 specific file access:
|
||||
// "r" for read only access.
|
||||
// "w" for read and write access.
|
||||
// "c" create a new a new file with if it does not exist already.
|
||||
// "cf" create a new file, overwrite it if it exists already.
|
||||
const string FILE_READ("r");
|
||||
const string FILE_READ_WRITE("w");
|
||||
const string FILE_CREATE("c");
|
||||
const string FILE_CREATE_FORCE("cf");
|
||||
|
||||
// Define the group names of the H5Fed starndard groups.
|
||||
const string H5FED_G_ROOT ("/HDF5_FINITE_ELEMENT_DATA");
|
||||
const string H5FED_G_COORD (H5FED_G_ROOT+"/COORD");
|
||||
const string H5FED_G_VOLUME_MESH (H5FED_G_ROOT+"/VOLUME_MESH");
|
||||
const string H5FED_G_BOUNDARY_MESH (H5FED_G_ROOT+"/BOUNDARY_MESH");
|
||||
const string H5FED_G_MATERIAL (H5FED_G_ROOT+"/MATERIAL");
|
||||
const string H5FED_G_ELECTROMAGNETIC (H5FED_G_MATERIAL+"/ELECTROMAGNETIC");
|
||||
const string H5FED_G_DISCRETE (H5FED_G_ELECTROMAGNETIC+"/DISCRETE");
|
||||
const string H5FED_G_PHYSICAL (H5FED_G_ELECTROMAGNETIC+"/PHYSICAL");
|
||||
const string H5FED_G_DEBYE (H5FED_G_PHYSICAL+"/DEBYE");
|
||||
const string H5FED_G_LORENTZ (H5FED_G_PHYSICAL+"/LORENTZ");
|
||||
const string H5FED_G_DRUDE (H5FED_G_PHYSICAL+"/DRUDE");
|
||||
const string H5FED_G_DOF (H5FED_G_ROOT+"/DOF");
|
||||
const string H5FED_G_FIELD (H5FED_G_ROOT+"/FIELD");
|
||||
|
||||
// Define the dataset names of the H5Fed standard datasets.
|
||||
const string H5FED_D_COORD3D (H5FED_G_COORD+"/COORD3D");
|
||||
const string H5FED_D_TETMESH (H5FED_G_VOLUME_MESH+"/TETMESH_L");
|
||||
const string H5FED_D_HEXMESH (H5FED_G_VOLUME_MESH+"/HEXMESH_L");
|
||||
const string H5FED_D_PRISMATICMESH (H5FED_G_VOLUME_MESH+"/PRISMATICMESH_L");
|
||||
const string H5FED_D_PYRAMIDMESH (H5FED_G_VOLUME_MESH+"/PYRAMIDMESH_L");
|
||||
const string H5FED_D_TRIANGLEMESH (H5FED_G_VOLUME_MESH+"/TRIANGLEMESH_L");
|
||||
const string H5FED_D_QUADRANGLEMESH (H5FED_G_VOLUME_MESH+"/QUADRANGLEMESH_L");
|
||||
|
||||
// How much nodes have a geometric figure.
|
||||
const unsigned short int H5FED_TET_N_NODE = 4;
|
||||
const unsigned short int H5FED_HEX_N_NODE = 8;
|
||||
const unsigned short int H5FED_PRISMATIC_N_NODE = 6;
|
||||
const unsigned short int H5FED_PYRAMID_N_NODE = 5;
|
||||
const unsigned short int H5FED_TRIANGLE_N_NODE = 3;
|
||||
const unsigned short int H5FED_QUADRANGLE_N_NODE = 4;
|
||||
|
||||
|
||||
#endif /*H5FEDCONST_HH_*/
|
||||
@@ -0,0 +1,14 @@
|
||||
## Makefile.am -- process this file with automake to produce Makefile.in
|
||||
##
|
||||
## authors - benedikt oswald and patrick leidenberger
|
||||
## modified - 2006 aug 24, patrick leidenberger, creation
|
||||
#
|
||||
## objective - automake input file for the h5fed directory
|
||||
## project - gmsh2h5fed
|
||||
|
||||
noinst_LTLIBRARIES = libh5fed.la
|
||||
h5feddir = $(topleveldir)/libsrc/h5fed
|
||||
h5fed_HEADERS = h5fed.hh
|
||||
libh5fed_la_SOURCES = h5fed.cc \
|
||||
h5fed.hh
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
@@ -0,0 +1,11 @@
|
||||
## Makefile.am -- process this file with automake to produce Makefile.in
|
||||
##
|
||||
## authors - benedikt oswald and patrick leidenberger
|
||||
## modified - 2006 aug 21, patrick leidenberger, creation
|
||||
## modified - 2006 aug 24, pl, add h5fed path.
|
||||
#
|
||||
## objective - automake input file for the libsrc directory
|
||||
## project - gmsh2h5fed
|
||||
|
||||
SUBDIRS = gmsh h5fed
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
@@ -0,0 +1,143 @@
|
||||
// rights - copyright by benedikt oswald, 2002-2006, all rights reserved
|
||||
// project - phidias3d
|
||||
// file name - nonsciconst.h
|
||||
// file type - c++ include file
|
||||
// author - benedikt oswald
|
||||
// modified - 2004 may 21, creation, benedikt oswald
|
||||
// modified - 2004 jun 11, added font definitions, benedikt oswald
|
||||
// modified - 2006 jun 26, transferred to project phidias3d, benedikt oswald
|
||||
// modified - 2006 jun 28, correction of RIGHTANGLE_DEG from int to double,
|
||||
// patrick leidenberger
|
||||
// modified - 2006 jul 11, add vtk cell type constants,
|
||||
// patrick leidenberger
|
||||
// objective - define technical, non-scientific constants, e.g. plot paper
|
||||
// dimensions etc.
|
||||
|
||||
|
||||
/* include standard libraries */
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
||||
#ifndef _NONSCICONST_
|
||||
#define _NONSCICONST_
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace nonsciconst
|
||||
{
|
||||
|
||||
const double A4WIDTH = 210.0;
|
||||
const double A4HEIGHT = 297.0;
|
||||
|
||||
const double A5WIDHT = 105.0;
|
||||
const double A5HEIGHT = 148.5;
|
||||
|
||||
const unsigned int FRAMED = 1;
|
||||
const unsigned int NOTFRAMED = 0;
|
||||
const unsigned int BELOW = 1;
|
||||
const unsigned int ABOVE = 0;
|
||||
const unsigned int ATLEFT = 1;
|
||||
const unsigned int ATRIGHT = 0;
|
||||
const unsigned int FILLED = 1;
|
||||
const unsigned int NOTFILLED = 0;
|
||||
const unsigned int OUTERFACES = 1;
|
||||
const unsigned int INNERFACES = 0;
|
||||
|
||||
const double RIGHTANGLE_DEG = 90.0;
|
||||
|
||||
const unsigned int DRAW_GRID_NODES_FLAG = 1;
|
||||
const unsigned int DRAW_GRID_LINES_FLAG = 1;
|
||||
|
||||
const double MAXHUE = 0.7;
|
||||
const double MAXSAT = 1.0;
|
||||
const double MAXBRG = 1.0;
|
||||
|
||||
const unsigned int GRAY_COLORSPACE = 0;
|
||||
const unsigned int RGB_COLORSPACE = 2;
|
||||
const unsigned int HSB_COLORSPACE = 4;
|
||||
const unsigned int CMYK_COLORSPACE = 8;
|
||||
|
||||
const double HSB_H_BLUE = 0.7;
|
||||
const double HSB_H_RED = 1.0;
|
||||
const double HSB_H_BLACK = 0.1;
|
||||
|
||||
const unsigned int LEGEND_HORIZONTAL = 1;
|
||||
const unsigned int LEGEND_VERTICAL = 0;
|
||||
|
||||
const unsigned int NUMCHARPLTFLNM = 256;
|
||||
const unsigned int NUMCHARSTRINGPLOTPROD = 256;
|
||||
const unsigned int DSPLYSTRLE = 512;
|
||||
const unsigned int MAXFILENAMSTRLEN = 512;
|
||||
const unsigned int DSPSTRLEN = 256;
|
||||
|
||||
const double MINIMUM_DB_VAL = -60.0;
|
||||
|
||||
const string HELVETICA_OBLIQUE_FNT("Helvetica-Oblique");
|
||||
const string HELVETICA_FNT("Helvetica");
|
||||
const string TIMES_FNT("Times-Roman");
|
||||
const string ARIAL_FNT("Arial");
|
||||
const string SYMBOL_FNT("Symbol");
|
||||
|
||||
const double INCHINPT = 72.0; /* define an inch in points, a typographic unit */
|
||||
const double INCHINMM = 25.4; /* define an inch in millimeter */
|
||||
|
||||
const string ELECTRIC_FIELD_UNIT_STRING("[V/m]");
|
||||
const string ELECTRIC_FIELD_UNIT_STRING_DB("[norm. dB]");
|
||||
|
||||
const double TEXT_DOWN_DIR_DEG = 270.0;
|
||||
const double TEXT_RIGHT_DIR_DEG = 0.0;
|
||||
|
||||
const unsigned int COLRSPCDIM = 3;
|
||||
|
||||
const double PSGRAF3_SYMBOL_RADIUS_PCOORD=0.3;
|
||||
|
||||
const int PSGRAF3_SYMBOL_CIRCLE = 0;
|
||||
const int PSGRAF3_SYMBOL_SQUARE = 1;
|
||||
const int PSGRAF3_SYMBOL_RHOMBUS = 2;
|
||||
const int PSGRAF3_SYMBOL_TRIANGLE_TIPUP = 3;
|
||||
const int PSGRAF3_SYMBOL_TRIANGLE_TIPDOWN = 4;
|
||||
|
||||
const int OKCODE = 0;
|
||||
const int ERRORCODE = 1;
|
||||
const int ERROR_SINGULAR_MATRIX = 2;
|
||||
const int ERROR_PSGRAF3_NOT_AVAILABLE = 3;
|
||||
const int ERROR_NNZ_IS_ZERO = 100;
|
||||
|
||||
|
||||
const string VTK_LFF_EXTENSION(".vtk");
|
||||
const string HDF5_EXTENSION(".h5");
|
||||
|
||||
const string TAB_STRING("\t");
|
||||
const string SINGLE_SPACE(" ");
|
||||
|
||||
|
||||
const int DEFAULT_FLOAT_PRECISION=6;
|
||||
|
||||
// Define constants for vtk cell types.
|
||||
const unsigned int VTK_VERTEX = 1;
|
||||
const unsigned int VTK_POLY_VERTEX = 2;
|
||||
const unsigned int VTK_LINE = 3;
|
||||
const unsigned int VTK_POLY_LINE = 4;
|
||||
const unsigned int VTK_TRIANGLE = 5;
|
||||
const unsigned int VTK_TRIANGEL_STRIP = 6;
|
||||
const unsigned int VTK_POLYGON = 7;
|
||||
const unsigned int VTK_PIXEL = 8;
|
||||
const unsigned int VTK_QUAD = 9;
|
||||
const unsigned int VTK_TETRA = 10;
|
||||
const unsigned int VTK_VOXEL = 11;
|
||||
const unsigned int VTK_HEXAHEDRON = 12;
|
||||
const unsigned int VTK_WEDGE = 13;
|
||||
const unsigned int VTK_PYRAMID = 14;
|
||||
const unsigned int VTK_QUADRATIC_EDGE = 21;
|
||||
const unsigned int VTK_QUADRATIC_TRIANGLE = 22;
|
||||
const unsigned int VTK_QUADRATIC_QUAD = 23;
|
||||
const unsigned int VTK_QUADRATIC_TETRA = 24;
|
||||
const unsigned int VTK_QUATRATIC_HEXAHEDRON = 25;
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
// rights - copyright by benedikt oswald, 2002-2006, all rights reserved
|
||||
// project - phidias3d
|
||||
// file name - physicomath.h
|
||||
// file type - c++ include file
|
||||
// author - benedikt oswald
|
||||
// modified - 2003 jan 30, creation -
|
||||
// modified - 2006 jun 26, transferred to project phidias3d, benedikt oswald
|
||||
// objective - physical and mathematical quantities, constansts etc.
|
||||
|
||||
#include <cmath>
|
||||
#include <complex>
|
||||
|
||||
#ifndef _PHYSICO_MATH_
|
||||
#define _PHYSICO_MATH_
|
||||
|
||||
using namespace std;
|
||||
|
||||
namespace physicomath
|
||||
{
|
||||
const double ZERO = 0;
|
||||
const int INT_ZERO = 0;
|
||||
const unsigned int UNSIGNED_INT_ZERO = 0;
|
||||
const double DOUBLE_ZERO = 0.0;
|
||||
const int INT_ONE = 1;
|
||||
const unsigned int UNSIGNED_INT_ONE = 1;
|
||||
const int INT_TWO = 2;
|
||||
const double DOUBLE_ONE = 1.0;
|
||||
const double DOUBLE_TWO = 2.0;
|
||||
|
||||
#ifndef IMAGINARY_UNIT_
|
||||
#define IMAGINARY_UNIT_
|
||||
const complex<double> IU(0.0,1.0);
|
||||
#endif
|
||||
|
||||
const double PI = 3.1415926535;
|
||||
const double EPSILON_ZERO = 8.85418782e-12;
|
||||
|
||||
const double MU_ZERO = 4.0 * PI * 1.0e-7;
|
||||
|
||||
const double SPEED_OF_LIGHT = (1.0/(sqrt(EPSILON_ZERO*MU_ZERO)));
|
||||
|
||||
const double Z0 = sqrt(MU_ZERO/EPSILON_ZERO);
|
||||
|
||||
const double TERAHERTZ = 1.0e12;
|
||||
const double GIGAHERTZ = 1.0e9;
|
||||
const double MEGAHERTZ = 1.0e6;
|
||||
const double KILOHERTZ = 1.0e3;
|
||||
|
||||
const double SECOND = 1.0e0;
|
||||
const double MILLISECOND = 1.0e-3;
|
||||
const double MICROSECOND = 1.0e-6;
|
||||
const double NANOSECOND = 1.0e-9;
|
||||
const double PICOSECOND = 1.0e-12;
|
||||
const double FEMTOSECOND = 1.0e-15;
|
||||
|
||||
|
||||
const double L_BAND_CENTER_FREQUENCY=1.414e9;
|
||||
|
||||
const double DOUBLE_REL_ZERO_LIMIT=1.0e-100;
|
||||
|
||||
|
||||
const double METER = 1.0; /* define a meter, the standard */
|
||||
const double DECIMETER = 0.1; /* define a tenth of a meter */
|
||||
const double CENTIMETER = 1.0e-2; /* define a centimeter */
|
||||
const double MICROMETER = 1.0e-6; /* define a micrometer */
|
||||
const double NANOMETER = 1.0e-9; /* define a nanomenter */
|
||||
const double ANGSTROM = 1.0e-10; /* define an angstrom */
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
## Makefile.am -- process this file with automake to produce Makefile.in
|
||||
##
|
||||
## authors - patrick leidenberger
|
||||
## modified - 2006 aug 21, patrick leidenberger, creation
|
||||
## objective - top level automake file for H5Fed
|
||||
## project - H5Fed
|
||||
|
||||
SUBDIRS = libsrc applications
|
||||
|
||||
AM_CPPFLAGS = @AM_CPPFLAGS@
|
||||
Reference in New Issue
Block a user