Skip to content
Snippets Groups Projects
Commit 7c6dd8a4 authored by Praetorius, Simon's avatar Praetorius, Simon
Browse files

PngReader implemented

parent 74f06100
No related branches found
No related tags found
No related merge requests found
......@@ -29,23 +29,27 @@ namespace AMDiS {
png_infop info_ptr;
FILE *fp;
unsigned int sig_read = 0;
int row, col, nVertices, nElements;
int row, col;
int bytesPerPixel = 0;
// Open files and create the png data structures.
if ((fp = fopen(filename.c_str(), "rb")) == NULL)
TEST_EXIT(0)("ERROR: file can not be opened\n");
if ((fp = fopen(filename.c_str(), "rb")) == NULL) {
TEST_EXIT(0)("ERROR: file can not >be opened\n");
}
png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (png_ptr == NULL)
if (png_ptr == NULL) {
TEST_EXIT(0)("ERROR in png_create_read_struct\n");
}
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == NULL)
if (info_ptr == NULL) {
TEST_EXIT(0)("ERROR in png_create_info_struct\n");
}
if (setjmp(png_jmpbuf(png_ptr)))
if (setjmp(png_jmpbuf(png_ptr))) {
TEST_EXIT(0)("ERROR in png_jmpbuf\n");
}
png_init_io(png_ptr, fp);
png_set_sig_bytes(png_ptr, sig_read);
......@@ -60,10 +64,6 @@ namespace AMDiS {
cout << "Bytes per pixel: " << bytesPerPixel << endl;
double value = 0;
const DOFAdmin* admin = vec->getFeSpace()->getAdmin();
int n0 = admin->getNumberOfPreDofs(VERTEX); //offset zum globale DOF-managment
int dim = vec->getFeSpace()->getMesh()->getDim();
int dow = Global::getGeo(WORLD);
const BasisFunction *basFcts = vec->getFeSpace()->getBasisFcts();
int numBasFcts = basFcts->getNumber();
DegreeOfFreedom *localIndices = new DegreeOfFreedom[numBasFcts];
......@@ -76,7 +76,6 @@ namespace AMDiS {
Mesh::CALL_LEAF_EL |
Mesh::FILL_COORDS);
while (elInfo) {
const DegreeOfFreedom **dof = elInfo->getElement()->getDof();
Element *el = elInfo->getElement();
basFcts->getLocalIndices(el, vec->getFeSpace()->getAdmin(), localIndices);
......@@ -96,7 +95,7 @@ namespace AMDiS {
static_cast<double>(info_ptr->row_pointers[row][col*3 + 2]));
break;
default:
TEST_EXIT(false)("ERROR: bytesPerPixel=%d is unknown case!\n",bytesPerPixel)
TEST_EXIT(false)("ERROR: bytesPerPixel=%d is unknown case!\n",bytesPerPixel);
}
(*vec)[localIndices[i]] = value;
}
......@@ -107,7 +106,6 @@ namespace AMDiS {
png_destroy_read_struct(&png_ptr, &info_ptr, NULL);
fclose(fp);
return(0);
}
}
};
};
......@@ -20,8 +20,8 @@
/** \file ValueReader.h */
#ifndef AMDIS_VALUEREADER_H
#define AMDIS_VALUEREADER_H
#ifndef AMDIS_PNGREADER_H
#define AMDIS_PNGREADER_H
#include "AMDiS.h"
......@@ -63,6 +63,7 @@ namespace AMDiS {
yMin = minDim[1]; yMax = maxDim[1];
};
};
}
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment