Skip to content
Snippets Groups Projects
Commit 83dfa5df authored by Akash Anand's avatar Akash Anand
Browse files

for FM

parent cd973b19
No related branches found
No related tags found
No related merge requests found
...@@ -849,19 +849,27 @@ void compute_cb(Fl_Widget *w, void *data) ...@@ -849,19 +849,27 @@ void compute_cb(Fl_Widget *w, void *data)
// IO Test Code // IO Test Code
char *filename = "patches.fm"; char *filename = "patches.fm";
FILE *fp = fopen(filename, "w"); FILE *fp = fopen(filename, "w+");
if(!fp){ if(!fp){
printf("Unable to open file '%s'\n", filename); printf("Unable to open file '%s'\n", filename);
return; return;
} }
std::set<GFace*, GEntityLessThan>::iterator fiter; std::set<GFace*, GEntityLessThan>::iterator fiter;
int numFourierPatches = 0;
for (fiter = GMODEL->firstFace(); fiter != GMODEL->lastFace(); fiter++) {
if ((*fiter)->getNativeType() == GEntity::FourierModel) {
numFourierPatches++;
}
}
fprintf(fp, "%d\n", numFourierPatches);
for (fiter = GMODEL->firstFace(); fiter != GMODEL->lastFace(); fiter++) { for (fiter = GMODEL->firstFace(); fiter != GMODEL->lastFace(); fiter++) {
if ((*fiter)->getNativeType() == GEntity::FourierModel) { if ((*fiter)->getNativeType() == GEntity::FourierModel) {
FFace* ff = (FFace*) (*fiter); FFace* ff = (FFace*) (*fiter);
ff->GetFMFace()->GetPatch()->Export(fp); ff->GetFMFace()->GetPatch()->Export(fp);
} }
} }
fclose(fp);
FM_Reader* reader = new FM_Reader(filename); FM_Reader* reader = new FM_Reader(filename);
// End Test // End Test
......
...@@ -7,7 +7,9 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -7,7 +7,9 @@ FM_Reader::FM_Reader(const char* fn)
{ {
char c; char c;
char Exact[8] = "Exact"; char Exact[8] = "Exact";
char plane[16] = "plane";
char cylinder[16] = "cylinder"; char cylinder[16] = "cylinder";
char paraboloid[16] = "paraboloid";
char revolvedParabola[32] = "revolvedParabola"; char revolvedParabola[32] = "revolvedParabola";
std::ifstream InputFile(fn); std::ifstream InputFile(fn);
...@@ -15,57 +17,88 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -15,57 +17,88 @@ FM_Reader::FM_Reader(const char* fn)
Msg::Info("Failed to open input file."); Msg::Info("Failed to open input file.");
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
//InputFile >> _nPatches; InputFile >> _nPatches;
//for (unsigned int i = 0; i < _nPatches; i++) { _ps.resize(_nPatches, 0);
unsigned int i = 0; std::cout << "npatches = " << _nPatches << std::endl;
while (!InputFile.eof()) { for (unsigned int i = 0; i < _nPatches; i++) {
char psName[32]; char psName[32];
InputFile >> psName; InputFile >> psName;
std::cout << psName; std::cout << "psName = " << psName << std::endl;
int psTag; int psTag;
std::cout << psTag;
InputFile >> psTag; InputFile >> psTag;
std::cout << "psTag = " << psTag << std::endl;
double origin[3]; double origin[3];
InputFile >> origin[0] >> origin[1] >> origin[2]; InputFile >> origin[0] >> origin[1] >> origin[2];
std::cout << "o = "<<origin[0]<<" "<<origin[1]<<" "<<origin[2]<<std::endl;
double E0[3]; double E0[3];
InputFile >> E0[0] >> E0[1] >> E0[2]; InputFile >> E0[0] >> E0[1] >> E0[2];
std::cout << "E0 = " << E0[0] <<" "<< E0[1] <<" "<< E0[2] << std::endl;
double E1[3]; double E1[3];
InputFile >> E1[0] >> E1[1] >> E1[2]; InputFile >> E1[0] >> E1[1] >> E1[2];
std::cout << "E1 = " << E1[0] <<" "<< E1[1] <<" "<< E1[2] << std::endl;
double scale[3]; double scale[3];
InputFile >> scale[0] >> scale[1] >> scale[2]; InputFile >> scale[0] >> scale[1] >> scale[2];
std::cout << "s = " <<scale[0]<<" "<< scale[1]<<" "<<scale[2]<<std::endl;
int psNumParams; int psNumParams;
InputFile >> psNumParams; InputFile >> psNumParams;
std::vector<double> psParams; std::cout << "psNumParams = " << psNumParams << std::endl;
double *psParams = new double [psNumParams];
for (unsigned int j = 0; j < psNumParams; j++) { for (unsigned int j = 0; j < psNumParams; j++) {
double tmp; double tmp;
InputFile >> tmp; InputFile >> psParams[j];
psParams.push_back(tmp); std::cout << "psParams[" << j << "] = " << psParams[j] << std::endl;
}
if (!strcmp(psName,plane))
_ps[i] = new PlaneProjectionSurface(psTag,origin,E0,E1,scale);
else if (!strcmp(psName,cylinder))
_ps[i] = new CylindricalProjectionSurface
(psTag,origin,E0,E1,scale,psParams[0],psParams[1]);
else if (!strcmp(psName,paraboloid)) {
double K[2];
K[0] = psParams[0]; K[1] = psParams[1];
_ps[i] = new ParaboloidProjectionSurface
(psTag,origin,E0,E1,scale,K);
} }
if (!strcmp(psName,cylinder))
_ps.push_back
(new CylindricalProjectionSurface
(psTag,origin,E0,E1,scale,psParams[0],psParams[1]));
else if (!strcmp(psName,revolvedParabola)) { else if (!strcmp(psName,revolvedParabola)) {
double R = psParams[0];
double K[2]; double K[2];
K[0] = psParams[1]; K[1] = psParams[2]; K[0] = psParams[1]; K[1] = psParams[2];
_ps.push_back(new RevolvedParabolaProjectionSurface printf("%d :: P : %g %g %g\n",i,R,K[0],K[1]);
(i,origin,E0,E1,scale,psParams[0],K)); printf("%d :: O : %g %g %g\n",i,origin[0],origin[1],origin[2]);
printf("%d :: E0 : %g %g %g\n",i,E0[0],E0[1],E0[2]);
printf("%d :: E1 : %g %g %g\n",i,E1[0],E1[1],E1[2]);
printf("%d :: s : %g %g %g\n",i,scale[0],scale[1],scale[2]);
_ps[i] = new RevolvedParabolaProjectionSurface
(psTag,origin,E0,E1,scale,R,K);
printf("%d : here :: %g %g\n",i,K[0],K[1]);
} }
else { else {
_ps.push_back _ps[i] = new CylindricalProjectionSurface(psTag,origin,E0,E1,scale);
(new CylindricalProjectionSurface(i,origin,E0,E1,scale));
Msg::Error("Unknown projection surface. Replaced by Cylinder..."); Msg::Error("Unknown projection surface. Replaced by Cylinder...");
} }
delete [] psParams;
InputFile >> psName; InputFile >> psName;
std::cout << "psName = " << psName << std::endl;
_patchList.push_back(new PatchInfo); _patchList.push_back(new PatchInfo);
InputFile >> _patchList[i]->tag; InputFile >> _patchList[i]->tag;
InputFile >> _patchList[i]->tag; std::cout << "pTag = " << _patchList[i]->tag << std::endl;
InputFile >> _patchList[i]->derivative;
std::cout << "pDerivative = " << _patchList[i]->derivative << std::endl;
InputFile >> _patchList[i]->uMin >> _patchList[i]->uMax; InputFile >> _patchList[i]->uMin >> _patchList[i]->uMax;
std::cout <<"uLim = "<<_patchList[i]->uMin<<" "<<_patchList[i]->uMax <<
std::endl;
InputFile >> _patchList[i]->vMin >> _patchList[i]->vMax; InputFile >> _patchList[i]->vMin >> _patchList[i]->vMax;
std::cout <<"vLim = "<<_patchList[i]->vMin<<" "<<_patchList[i]->vMax <<
std::endl;
if (strcmp(psName,Exact)) { if (strcmp(psName,Exact)) {
InputFile >> _patchList[i]->hardEdge[0] >> _patchList[i]->hardEdge[1] >> InputFile >> _patchList[i]->hardEdge[0] >> _patchList[i]->hardEdge[1] >>
_patchList[i]->hardEdge[2] >> _patchList[i]->hardEdge[3]; _patchList[i]->hardEdge[2] >> _patchList[i]->hardEdge[3];
std::cout<<"HE : "<< _patchList[i]->hardEdge[0] << " " <<
_patchList[i]->hardEdge[1] << " " << _patchList[i]->hardEdge[2]
<< " " << _patchList[i]->hardEdge[3] << std::endl;
InputFile >> _patchList[i]->nModes[0] >> _patchList[i]->nModes[1]; InputFile >> _patchList[i]->nModes[0] >> _patchList[i]->nModes[1];
std::cout <<"Modes = "<<_patchList[i]->nModes[0] << " " <<
_patchList[i]->nModes[1] << std::endl;
_patchList[i]->coeffFourier.resize(_patchList[i]->nModes[0]); _patchList[i]->coeffFourier.resize(_patchList[i]->nModes[0]);
for (int j=0;j<_patchList[i]->nModes[0];j++) { for (int j=0;j<_patchList[i]->nModes[0];j++) {
_patchList[i]->coeffFourier[j].resize(_patchList[i]->nModes[1]); _patchList[i]->coeffFourier[j].resize(_patchList[i]->nModes[1]);
...@@ -74,10 +107,14 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -74,10 +107,14 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffFourier[j][k] = _patchList[i]->coeffFourier[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
InputFile >> _patchList[i]->nM[0] >> _patchList[i]->nM[1]; InputFile >> _patchList[i]->nM[0] >> _patchList[i]->nM[1];
std::cout <<"M = "<<_patchList[i]->nM[0] << " " <<
_patchList[i]->nM[1] << std::endl;
InputFile >> _patchList[i]->recompute; InputFile >> _patchList[i]->recompute;
std::cout << "pRecompute = " << _patchList[i]->recompute << std::endl;
if ((_patchList[i]->derivative) && (!_patchList[i]->recompute)) { if ((_patchList[i]->derivative) && (!_patchList[i]->recompute)) {
_patchList[i]->coeffCheby.resize(_patchList[i]->nM[0]); _patchList[i]->coeffCheby.resize(_patchList[i]->nM[0]);
for (int j=0;j<_patchList[i]->nM[0];j++) { for (int j=0;j<_patchList[i]->nM[0];j++) {
...@@ -87,6 +124,7 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -87,6 +124,7 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffCheby[j][k] = _patchList[i]->coeffCheby[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
_patchList[i]->coeffDerivU.resize(_patchList[i]->nM[0]); _patchList[i]->coeffDerivU.resize(_patchList[i]->nM[0]);
...@@ -97,6 +135,7 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -97,6 +135,7 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffDerivU[j][k] = _patchList[i]->coeffDerivU[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
_patchList[i]->coeffDerivV.resize(_patchList[i]->nM[0]); _patchList[i]->coeffDerivV.resize(_patchList[i]->nM[0]);
...@@ -107,6 +146,7 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -107,6 +146,7 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffDerivV[j][k] = _patchList[i]->coeffDerivV[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
_patchList[i]->coeffDerivUU.resize(_patchList[i]->nM[0]); _patchList[i]->coeffDerivUU.resize(_patchList[i]->nM[0]);
...@@ -117,6 +157,7 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -117,6 +157,7 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffDerivUU[j][k] = _patchList[i]->coeffDerivUU[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
_patchList[i]->coeffDerivUV.resize(_patchList[i]->nM[0]); _patchList[i]->coeffDerivUV.resize(_patchList[i]->nM[0]);
...@@ -127,6 +168,7 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -127,6 +168,7 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffDerivUV[j][k] = _patchList[i]->coeffDerivUV[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
_patchList[i]->coeffDerivVV.resize(_patchList[i]->nM[0]); _patchList[i]->coeffDerivVV.resize(_patchList[i]->nM[0]);
...@@ -137,14 +179,13 @@ FM_Reader::FM_Reader(const char* fn) ...@@ -137,14 +179,13 @@ FM_Reader::FM_Reader(const char* fn)
InputFile >> realCoeff >> imagCoeff; InputFile >> realCoeff >> imagCoeff;
_patchList[i]->coeffDerivVV[j][k] = _patchList[i]->coeffDerivVV[j][k] =
std::complex<double>(realCoeff,imagCoeff); std::complex<double>(realCoeff,imagCoeff);
std::cout << realCoeff << " " << imagCoeff << std::endl;
} }
} }
} }
} }
_patch.push_back(new ContinuationPatch(_patchList[i], _ps[i])); _patch.push_back(new ContinuationPatch(_patchList[i], _ps[i]));
i++;
} }
_nPatches = _patch.size();
} }
Patch* FM_Reader::GetPatch(int tag) Patch* FM_Reader::GetPatch(int tag)
......
...@@ -8,7 +8,9 @@ ...@@ -8,7 +8,9 @@
#include "IntersectionCurve.h" #include "IntersectionCurve.h"
#include "ExactPatch.h" #include "ExactPatch.h"
#include "ContinuationPatch.h" #include "ContinuationPatch.h"
#include "PlaneProjectionSurface.h"
#include "CylindricalProjectionSurface.h" #include "CylindricalProjectionSurface.h"
#include "ParaboloidProjectionSurface.h"
#include "RevolvedParabolaProjectionSurface.h" #include "RevolvedParabolaProjectionSurface.h"
#include "FM_Info.h" #include "FM_Info.h"
#include "FM_Face.h" #include "FM_Face.h"
......
...@@ -860,7 +860,6 @@ void FPatch::Export(FILE *fp) ...@@ -860,7 +860,6 @@ void FPatch::Export(FILE *fp)
{ {
double x,y,z; double x,y,z;
fprintf(fp, "\n");
fprintf(fp, "%s\n", _ps->GetName().c_str()); fprintf(fp, "%s\n", _ps->GetName().c_str());
fprintf(fp, "%d\n", _ps->GetTag()); fprintf(fp, "%d\n", _ps->GetTag());
_ps->GetOrigin(x,y,z); _ps->GetOrigin(x,y,z);
......
...@@ -4,7 +4,7 @@ ParaboloidProjectionSurface::ParaboloidProjectionSurface ...@@ -4,7 +4,7 @@ ParaboloidProjectionSurface::ParaboloidProjectionSurface
(int tag) : ProjectionSurface(1.) (int tag) : ProjectionSurface(1.)
{ {
SetTag(tag); SetTag(tag);
SetName(std::string("Paraboloid")); SetName(std::string("paraboloid"));
twoPi_ = 2 * M_PI; twoPi_ = 2 * M_PI;
K_[0] = K_[1] = 0.5; K_[0] = K_[1] = 0.5;
......
#include "PlaneProjectionSurface.h" #include "PlaneProjectionSurface.h"
PlaneProjectionSurface::PlaneProjectionSurface PlaneProjectionSurface::PlaneProjectionSurface
(int tag) : ProjectionSurface(1.) (int tag) : ProjectionSurface()
{ {
SetTag(tag); SetTag(tag);
SetName(std::string("Plane")); SetName(std::string("plane"));
numParameters_ = 0; numParameters_ = 0;
...@@ -19,7 +19,7 @@ PlaneProjectionSurface::PlaneProjectionSurface ...@@ -19,7 +19,7 @@ PlaneProjectionSurface::PlaneProjectionSurface
PlaneProjectionSurface::PlaneProjectionSurface PlaneProjectionSurface::PlaneProjectionSurface
(int tag, double O[3], double E0[3], double E1[3], double scale[3]) (int tag, double O[3], double E0[3], double E1[3], double scale[3])
: ProjectionSurface(1.) : ProjectionSurface()
{ {
SetTag(tag); SetTag(tag);
SetName(std::string("Plane")); SetName(std::string("Plane"));
......
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
ProjectionSurface::ProjectionSurface ProjectionSurface::ProjectionSurface
(double uPeriod, double vPeriod) (double uPeriod, double vPeriod)
{ {
printf("here in ProjectoionSufrace\n");
tag_ = -1; tag_ = -1;
name_ = std::string("default"); name_ = std::string("default");
numParameters_ = 0; numParameters_ = 0;
......
...@@ -26,6 +26,8 @@ RevolvedParabolaProjectionSurface::RevolvedParabolaProjectionSurface ...@@ -26,6 +26,8 @@ RevolvedParabolaProjectionSurface::RevolvedParabolaProjectionSurface
(int tag, double O[3], double E0[3], double E1[3], double scale[3], (int tag, double O[3], double E0[3], double E1[3], double scale[3],
double R, double K[2]) : ProjectionSurface(1.) double R, double K[2]) : ProjectionSurface(1.)
{ {
printf("here\n");
SetTag(tag); SetTag(tag);
SetName(std::string("revolvedParabola")); SetName(std::string("revolvedParabola"));
...@@ -44,6 +46,12 @@ RevolvedParabolaProjectionSurface::RevolvedParabolaProjectionSurface ...@@ -44,6 +46,12 @@ RevolvedParabolaProjectionSurface::RevolvedParabolaProjectionSurface
E2_[2] = E0_[0] * E1_[1] - E0_[1] * E1_[0]; E2_[2] = E0_[0] * E1_[1] - E0_[1] * E1_[0];
scale_[0] = scale[0]; scale_[1] = scale[1]; scale_[2] = scale[2]; scale_[0] = scale[0]; scale_[1] = scale[1]; scale_[2] = scale[2];
printf("P : %g %g %g\n",R_,K_[0],K_[1]);
printf("O : %g %g %g\n",O_[0],O_[1],O_[2]);
printf("E0 : %g %g %g\n",E0_[0],E0_[1],E0_[2]);
printf("E1 : %g %g %g\n",E1_[0],E1_[1],E1_[2]);
printf("s : %g %g %g\n",scale_[0],scale_[1],scale_[2]);
} }
void RevolvedParabolaProjectionSurface::F void RevolvedParabolaProjectionSurface::F
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment