Permalink
Browse files

Replacing all the src files I modified with Fabien to the ones from T…

…ianyang
  • Loading branch information...
Andreas
Andreas committed Sep 30, 2014
1 parent 8ca1cc4 commit 7eaf58ad91e55cc0aa2a41c6038ce5051de10881
@@ -61,6 +61,19 @@ void EMPIRE_API_sendIGAMesh(char *_name, int _numPatches, int _numNodes) {
empire->sendIGAMesh(_numPatches, _numNodes);
}

void EMPIRE_API_sendIGATrimmingInfo(int _isTrimmed, int _numLoops) {
empire->sendIGATrimmingInfo(_isTrimmed, _numLoops);
}

void EMPIRE_API_sendIGATrimmingLoopInfo(int _inner, int _numCurves) {
empire->sendIGATrimmingLoopInfo(_inner, _numCurves);
}

void EMPIRE_API_sendIGATrimmingCurve(int _direction, int _pDegree, int _uNumKnots, double* _uKnotVector, int _uNumControlPoints, double* _cpNet) {
empire->sendIGATrimmingCurve(_direction, _pDegree, _uNumKnots, _uKnotVector, _uNumControlPoints, _cpNet);
}


void EMPIRE_API_sendDataField(char *name, int sizeOfArray, double *dataField) {
empire->sendDataField(sizeOfArray, dataField);
}
@@ -86,6 +86,24 @@ void Empire::sendIGAPatch(int _pDegree, int _uNumKnots, double* _uKnotVector, in
ClientCommunication::getSingleton()->sendToServerBlocking<int>(_uNumControlPoints * _vNumControlPoints, _nodeNet);
}

void Empire::sendIGATrimmingInfo(int _isTrimmed, int _numLoops){
const int BUFFER_SIZE = 2;
int trimInfo[BUFFER_SIZE] = { _isTrimmed, _numLoops};
ClientCommunication::getSingleton()->sendToServerBlocking<int>(BUFFER_SIZE,trimInfo);
}
void Empire::sendIGATrimmingLoopInfo(int _inner, int _numCurves){
const int BUFFER_SIZE = 2;
int trimInfo[BUFFER_SIZE] = { _inner, _numCurves};
ClientCommunication::getSingleton()->sendToServerBlocking<int>(BUFFER_SIZE,trimInfo);
}
void Empire::sendIGATrimmingCurve(int _direction, int _pDegree, int _uNumKnots, double* _uKnotVector, int _uNumControlPoints, double* _cpNet){
const int BUFFER_SIZE = 4;
int trimInfo[BUFFER_SIZE] = { _direction, _pDegree, _uNumKnots, _uNumControlPoints};
ClientCommunication::getSingleton()->sendToServerBlocking<int>(BUFFER_SIZE,trimInfo);
ClientCommunication::getSingleton()->sendToServerBlocking<double>(_uNumKnots,_uKnotVector);
ClientCommunication::getSingleton()->sendToServerBlocking<double>(_uNumControlPoints, _cpNet);
}

void Empire::sendDataField(int sizeOfArray, double *dataField) {
ClientCommunication::getSingleton()->sendToServerBlocking<int>(1, &sizeOfArray);
ClientCommunication::getSingleton()->sendToServerBlocking<double>(sizeOfArray, dataField);
@@ -109,6 +109,31 @@ class Empire {
* \author Chenshen Wu
***********/
void sendIGAMesh(int _numPatches, int _numNodes);
/***********************************************************************************************
* \brief Send the IGA trimming information to the server
* \param[in] _isTrimmed Whether the current considered patch is trimmed
* \param[in] _numLoops The number of loops defining boundary
* \author Fabien Pean
***********/
void sendIGATrimmingInfo(int _isTrimmed, int _numLoops);
/***********************************************************************************************
* \brief Send the IGA trimming information about the loop to the server
* \param[in] _inner whether loop is outter boundary loop or inner
* \param[in] _numCurves The number of curves defining the loop
* \author Fabien Pean
***********/
void sendIGATrimmingLoopInfo(int _inner, int _numCurves);
/***********************************************************************************************
* \brief Send a IGA trimming curve to the server
* \param[in] direction The direction of the curve if is following standard or not
* \param[in] _pDegree The polynomial degree of the IGA 1D curve in the u-direction
* \param[in] _uNumKnots The number of knots for the knot vector in the u-direction
* \param[in] _uKnotVector The underlying knot vector of the IGA 1D curve in the u-direction
* \param[in] _uNoControlPoints The number of the Control Points for the 1D NURBS patch in the u-direction
* \param[in] _controlPointNet The set of the Control Points related to the 1D NURBS patch
* \author Fabien Pean
***********/
void sendIGATrimmingCurve(int _direction, int _pDegree, int _uNumKnots, double* _uKnotVector, int _uNumControlPoints, double* _cpNet);
/***********************************************************************************************
* \brief Send data field to the server
* \param[in] sizeOfArray size of the array (data field)
@@ -111,6 +111,32 @@ void EMPIRE_API_sendIGAPatch(int _pDegree, int _uNumKnots, double* _uKnotVector
***********/
void EMPIRE_API_sendIGAMesh(char *_name, int _numPatches, int _numNodes);

/***********************************************************************************************
* \brief Send the IGA trimming information to the server
* \param[in] _isTrimmed Whether the current considered patch is trimmed
* \param[in] _numLoops The number of loops defining boundary
* \author Fabien Pean
***********/
void EMPIRE_API_sendIGATrimmingInfo(int _isTrimmed, int _numLoops);
/***********************************************************************************************
* \brief Send the IGA trimming information about the loop to the server
* \param[in] _inner whether loop is outter boundary loop or inner
* \param[in] _numCurves The number of curves defining the loop
* \author Fabien Pean
***********/
void EMPIRE_API_sendIGATrimmingLoopInfo(int _inner, int _numCurves);
/***********************************************************************************************
* \brief Send a IGA trimming curve to the server
* \param[in] direction The direction of the curve if is following standard or not
* \param[in] _pDegree The polynomial degree of the IGA 1D curve in the u-direction
* \param[in] _uNumKnots The number of knots for the knot vector in the u-direction
* \param[in] _uKnotVector The underlying knot vector of the IGA 1D curve in the u-direction
* \param[in] _uNoControlPoints The number of the Control Points for the 1D NURBS patch in the u-direction
* \param[in] _controlPointNet The set of the Control Points related to the 1D NURBS patch
* \author Fabien Pean
***********/
void EMPIRE_API_sendIGATrimmingCurve(int _direction, int _pDegree, int _uNumKnots, double* _uKnotVector, int _uNumControlPoints, double* _cpNet);

/***********************************************************************************************
* \brief Send data field to the server
* \param[in] name name of the field
@@ -124,8 +124,51 @@ void ClientCode::recvIGAMesh(std::string meshName) {
serverComm->receiveFromClientBlocking<int>(name, uNoControlPoints * vNoControlPoints,
dofIndexNet);

theIGAMesh->addPatch(pDegree, uNoKnots, uKnotVector, qDegree, vNoKnots, vKnotVector,
IGAPatchSurface* thePatch = theIGAMesh->addPatch(pDegree, uNoKnots, uKnotVector, qDegree, vNoKnots, vKnotVector,
uNoControlPoints, vNoControlPoints, controlPointNet, dofIndexNet);

/*
int isTrimmed = 0;
serverComm->receiveFromClientBlocking<int>(name, 1, isTrimmed);
int numLoops;
serverComm->receiveFromClientBlocking<int>(name, 1, numLoops);
for(int loopCount = 0; loopCount < numLoops; loopCount++) {
const int BUFFER_SIZE_TRIM = 2;
int trimInfo[BUFFER_SIZE_TRIM];
serverComm->receiveFromClientBlocking<int>(name, BUFFER_SIZE_TRIM, trimInfo);
int inner = trimInfo[0];
int numCurves = trimInfo[1];
thePatch->addTrimLoop(inner, numCurves);
const int BUFFER_SIZE_CURVE = 4;
int curveInfo[BUFFER_SIZE_CURVE];
for(int curveCount = 0; curveCount < numCurves; curveCount++) {
serverComm->receiveFromClientBlocking<int>(name, BUFFER_SIZE_CURVE, curveInfo);
int direction = patchInfo[0];
int pDegree = patchInfo[1];
int uNoKnots = patchInfo[2];
int uNoControlPoints = patchInfo[3];
double* uKnotVector = new double[uNoKnots];
double* controlPointNet = new double[uNoControlPoints * 4];
int* dofIndexNet = new int[uNoControlPoints];
serverComm->receiveFromClientBlocking<double>(name, uNoKnots, uKnotVector);
serverComm->receiveFromClientBlocking<double>(name, uNoControlPoints * 4, controlPointNet);
serverComm->receiveFromClientBlocking<int>(name, uNoControlPoints, dofIndexNet);
thePatch->addTrimCurve(direction, ID??int ID, pDegree, uNoKnots, uKnotVector,
uNoControlPoints, controlPointNet;
///HOW TO DO FOR COUPLING CURVES ??
}
}
*/


}

@@ -121,23 +121,23 @@ class BSplineBasis1D: public AbstractBSplineBasis1D {
* \brief Returns the polynomial degree of the B-Spline 1D basis
* \author Andreas Apostolatos
***********/
inline int getPolynomialDegree() {
inline int getPolynomialDegree() const {
return PDegree;
}

/***********************************************************************************************
* \brief Returns the number of knots for the 1D B-Spline basis
* \author Andreas Apostolatos
***********/
inline int getNoKnots() {
inline int getNoKnots() const {
return NoKnots;
}

/***********************************************************************************************
* \brief Returns the knot vector of the B-Spline 1D basis
* \author Andreas Apostolatos
***********/
double* getKnotVector() {
double* getKnotVector() const {
return KnotVector;
}

@@ -44,7 +44,7 @@ IGAMesh::~IGAMesh() {
delete surfacePatches[i];
}

void IGAMesh::addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree,
IGAPatchSurface* IGAMesh::addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree,
int _vNoKnots, double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
double* _controlPointNet, int* _dofIndexNet) {

@@ -67,8 +67,20 @@ void IGAMesh::addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _q
surfacePatches.push_back(
new IGAPatchSurface(IDBasis, _pDegree, _uNoKnots, _uKnotVector, _qDegree, _vNoKnots,
_vKnotVector, _uNoControlPoints, _vNoControlPoints, cpNet));
return surfacePatches.back();

}

// IGAPatchSurface* IGAMesh::addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree,
// int _vNoKnots, double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
// double* _controlPointNet, int* _dofIndexNet) {
//
// addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree,
// int _vNoKnots, double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
// double* _controlPointNet, int* _dofIndexNet);
// return surfacePatches.back();
// }

void IGAMesh::computeBoundingBox() {
if (boundingBox.isComputed)
return;
@@ -82,9 +82,13 @@ class IGAMesh: public AbstractMesh {
* \param[in] _dofIndexNet The index of the dof of the each Control Points related to
* \author Chenshen Wu
***********/
void addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree, int _vNoKnots,
double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
double* controlPointNet, int* _dofIndexNet);
// void addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree, int _vNoKnots,
// double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
// double* controlPointNet, int* _dofIndexNet);

IGAPatchSurface* addPatch(int _pDegree, int _uNoKnots, double* _uKnotVector, int _qDegree, int _vNoKnots,
double* _vKnotVector, int _uNoControlPoints, int _vNoControlPoints,
double* controlPointNet, int* _dofIndexNet);

/// Specializing abstract functions from AbstractMesh class
public:
@@ -147,6 +147,26 @@ double IGAPatchSurface::computePostprocessingScalarValue(double _u, double _v,
return result;
}

void IGAPatchSurface::addTrimLoop(int inner, int numCurves) {
Trimming.addTrimLoop(inner, numCurves);
}

void IGAPatchSurface::addTrimCurve(int direction, int ID, int _pDegree, int _uNoKnots, double* _uKnotVector,
int _uNoControlPoints, double* _controlPointNet) {

int IDBasis = 0; ///???

int numCPs = _uNoControlPoints;
IGAControlPoint **cpNet;
cpNet = new IGAControlPoint*[numCPs];

for (int i = 0; i < numCPs; i++) {
cpNet[i] = new IGAControlPoint(i, &_controlPointNet[i * 4]);
}
Trimming.addTrimCurve(direction, IDBasis, _pDegree, _uNoKnots, _uKnotVector,
_uNoControlPoints, cpNet);
}

void IGAPatchSurface::computeCartesianCoordinates(double* _cartesianCoordinates, double _uPrm,
int _uKnotSpanIndex, double _vPrm, int _vKnotSpanIndex) {
/*
@@ -31,6 +31,7 @@
#include "AbstractMesh.h"
#include "NurbsBasis2D.h"
#include "IGAControlPoint.h"
#include "IGAPatchSurfaceTrimming.h"
#include <limits>

namespace EMPIRE {
@@ -55,6 +56,9 @@ class IGAPatchSurface {

/// The set of the Control Points of the patch
IGAControlPoint** ControlPointNet;

/// The class holding the trimming information
IGAPatchSurfaceTrimming Trimming;

/// The constructor and the destructor and the copy constructor
public:
@@ -80,6 +84,31 @@ class IGAPatchSurface {
***********/
~IGAPatchSurface();


/// Trimming related functions
public:
/***********************************************************************************************
* \brief Setup information about the loop soon to be received
* \param[in] inner 0 for outter and 1 for inner
* \param[in] numCurves Number of curves to be received for this loop
* \author Fabien Pean
***********/
void addTrimLoop(int inner, int numCurves);
/***********************************************************************************************
* \brief Add a Nurbs curve for the current loop and its attached information
* \param[in] inner Value 0 for outter and 1 for inner
* \param[in] direction The direction of the curve if is following standard or not
* \param[in] ID The id of the curve
* \param[in] _pDegree The polynomial degree of the IGA 1D curve in the u-direction
* \param[in] _uNoKnots The number of knots for the knot vector in the u-direction
* \param[in] _uKnotVector The underlying knot vector of the IGA 1D curve in the u-direction
* \param[in] _uNoControlPoints The number of the Control Points for the 1D NURBS patch in the u-direction
* \param[in] _controlPointNet The set of the Control Points related to the 1D NURBS patch
* \author Fabien Pean
***********/
void addTrimCurve(int direction,int ID, int _pDegree, int _uNoKnots, double* _uKnotVector,
int _uNoControlPoints, double* _controlPointNet);

/// Basis related functions
public:
/***********************************************************************************************
@@ -26,6 +26,7 @@
#ifndef MATHLIBRARY_H_
#define MATHLIBRARY_H_

#include <fstream>
#include <vector>
#include <cstdlib>
#include <map>
@@ -399,6 +400,30 @@ class SparseMatrix {
std::cout << std::endl;

}
/***********************************************************************************************
* \brief This prints the matrix in full style in a file
* \author Fabien Pean
***********/
void printToFile(std::string filename) {
size_t ii_counter;
size_t jj_counter;

std::ofstream ofs;
ofs.open(filename.c_str(), std::ofstream::out);
ofs<<"[";
for (ii_counter = 0; ii_counter < m; ii_counter++) {
for (jj_counter = 0; jj_counter < n; jj_counter++) {
if ((*mat)[ii_counter].find(jj_counter) != (*mat)[ii_counter].end()) {
ofs<<(*mat)[ii_counter].find(jj_counter)->second<<" ";
} else {
ofs<<"0 ";
}
}
ofs<<std::endl;
}
ofs<<"];";
ofs.close();
}
private:
/// pointer to the vector of maps
mat_t* mat;
@@ -2387,7 +2387,7 @@ class TestIGAMortarMapperTube: public CppUnit::TestFixture {
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(1,2) - 0.01542993469720) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(1,22) - 0.00677011599666) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(1,23) - 0.02830393435985) < Tol);
/*CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(1,24) - 0.00737974755614) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(1,24) - 0.00737974755614) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(2,2) - 0.06421957460831) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(2,3) - 0.01667060817364) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NN)(2,23) - 0.00737974755614) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NR)(263,111) - 0.02076332209870) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NR)(263,123) - 0.00057078576912) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NR)(263,124) - 0.00645490574604) < Tol);
CPPUNIT_ASSERT(fabs((*theMapper->C_NR)(263,125) - 0.01451543128523) < Tol);*/
CPPUNIT_ASSERT(fabs((*theMapper->C_NR)(263,125) - 0.01451543128523) < Tol);


}
@@ -1,7 +1,13 @@
libGiDFileIO.so : GiDFileIO.cpp
icpc -c -fPIC GiDFileIO.cpp -o GiDFileIO.o
icpc -shared -Wl,-soname,libGiDFileIO.so -o libGiDFileIO.so GiDFileIO.o
# LINK MATLIB INTERFACE LIBRARIES
MATLIB_HOME = /opt/MATLAB/R2012a
MATLIB_ARC = glnxa64
INCLUDES += -I$(MATLIB_HOME)/extern/include
#RPATH = -Wl,-rpath,$(MATLIB_HOME)/bin/glnxa64

# libGiDFileIO.so : GiDFileIO.cpp
# icpc -c -fPIC GiDFileIO.cpp -o GiDFileIO.o
# icpc $(RPATH) -shared -Wl,-soname,libGiDFileIO.so -o libGiDFileIO.so GiDFileIO.o

GiDFileIO.a : GiDFileIO.cpp
icpc -c -fPIC GiDFileIO.cpp -o GiDFileIO.o #without -fPIC cannot include .a into .so (.mex)
ar -cvq GiDFileIO.a GiDFileIO.o
icpc $(RPATH) -c -fPIC GiDFileIO.cpp -o GiDFileIO.o #without -fPIC cannot include .a into .so (.mex)
ar -cvq GiDFileIO.a GiDFileIO.o
Oops, something went wrong.

0 comments on commit 7eaf58a

Please sign in to comment.