Skip to content

Commit

Permalink
enable trimming data receiving
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabien P committed Oct 9, 2014
1 parent d95fd17 commit b87c359
Show file tree
Hide file tree
Showing 6 changed files with 72 additions and 45 deletions.
4 changes: 4 additions & 0 deletions EMPIRE_API/src/ApiWrapperFromCppToC.cpp
Expand Up @@ -65,6 +65,10 @@ void EMPIRE_API_sendIGATrimmingInfo(int _isTrimmed, int _numLoops) {
empire->sendIGATrimmingInfo(_isTrimmed, _numLoops);
}

void EMPIRE_API_sendIGATrimmingPatchInfo(int _uNumKnots, int _vNumKnots, int* _knotSpanBelonging) {
empire->sendIGATrimmingPatchInfo(_uNumKnots, _vNumKnots, _knotSpanBelonging);
}

void EMPIRE_API_sendIGATrimmingLoopInfo(int _inner, int _numCurves) {
empire->sendIGATrimmingLoopInfo(_inner, _numCurves);
}
Expand Down
6 changes: 5 additions & 1 deletion EMPIRE_API/src/Empire.cpp
Expand Up @@ -90,6 +90,10 @@ 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::sendIGATrimmingPatchInfo(int _uNumKnots, int _vNumKnots, int* _knotSpanBelonging){
ClientCommunication::getSingleton()->sendToServerBlocking<int>((_uNumKnots-1)*(_vNumKnots-1), _knotSpanBelonging);
}
void Empire::sendIGATrimmingLoopInfo(int _inner, int _numCurves){
const int BUFFER_SIZE = 2;
Expand All @@ -101,7 +105,7 @@ void Empire::sendIGATrimmingCurve(int _direction, int _pDegree, int _uNumKnots,
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);
ClientCommunication::getSingleton()->sendToServerBlocking<double>(_uNumControlPoints*4, _cpNet);
}

void Empire::sendDataField(int sizeOfArray, double *dataField) {
Expand Down
8 changes: 8 additions & 0 deletions EMPIRE_API/src/Empire.h
Expand Up @@ -116,6 +116,14 @@ class Empire {
* \author Fabien Pean
***********/
void sendIGATrimmingInfo(int _isTrimmed, int _numLoops);
/***********************************************************************************************
* \brief Send the IGA trimming information about patch to the server
* \param[in] _uNumKnots The number of knots in U direction
* \param[in] _vNumKnots The number of knots in V direction
* \param[in] _knotSpanBelonging The array indicating the knots state, inside,trimmed,outside
* \author Fabien Pean
***********/
void sendIGATrimmingPatchInfo(int _uNumKnots, int _vNumKnots, int* _knotSpanBelonging);
/***********************************************************************************************
* \brief Send the IGA trimming information about the loop to the server
* \param[in] _inner whether loop is outter boundary loop or inner
Expand Down
8 changes: 8 additions & 0 deletions EMPIRE_API/src/include/EMPIRE_API.h
Expand Up @@ -118,6 +118,14 @@ void EMPIRE_API_sendIGAMesh(char *_name, int _numPatches, int _numNodes);
* \author Fabien Pean
***********/
void EMPIRE_API_sendIGATrimmingInfo(int _isTrimmed, int _numLoops);
/***********************************************************************************************
* \brief Send the IGA trimming information about patch to the server
* \param[in] _uNumKnots The number of knots in U direction
* \param[in] _vNumKnots The number of knots in V direction
* \param[in] _knotSpanBelonging The array indicating the knots state, inside,trimmed,outside
* \author Fabien Pean
***********/
void EMPIRE_API_sendIGATrimmingPatchInfo(int _uNumKnots, int _vNumKnots, int* _knotSpanBelonging);
/***********************************************************************************************
* \brief Send the IGA trimming information about the loop to the server
* \param[in] _inner whether loop is outter boundary loop or inner
Expand Down
89 changes: 46 additions & 43 deletions Emperor/src/ClientCode.cpp
Expand Up @@ -127,50 +127,53 @@ void ClientCode::recvIGAMesh(std::string meshName) {
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 ??
}
}
*/


}
int trimInfo[2];
serverComm->receiveFromClientBlocking<int>(name, 2, trimInfo);
int isTrimmed = trimInfo[0];
int numLoops = trimInfo[1];
if(isTrimmed) {
assert(numLoops>0);
//Get knot span belonging (OUT,TRIM,IN), useful ?
int* knotSpanBelonging = new int[uNoKnots*vNoKnots];
serverComm->receiveFromClientBlocking<int>(name, (uNoKnots-1)*(vNoKnots-1), knotSpanBelonging);
thePatch->addTrimInfo(knotSpanBelonging);
delete knotSpanBelonging;
//Get every loop
for(int loopCount = 0; loopCount < numLoops; loopCount++) {

const int BUFFER_SIZE_TRIM = 2;
int loopInfo[BUFFER_SIZE_TRIM];
serverComm->receiveFromClientBlocking<int>(name, BUFFER_SIZE_TRIM, loopInfo);

int inner = loopInfo[0];
int numCurves = loopInfo[1];
thePatch->addTrimLoop(inner, numCurves);

const int BUFFER_SIZE_CURVE = 4;
int curveInfo[BUFFER_SIZE_CURVE];
//Get every curve
for(int curveCount = 0; curveCount < numCurves; curveCount++) {
serverComm->receiveFromClientBlocking<int>(name, BUFFER_SIZE_CURVE, curveInfo);

int direction = curveInfo[0];
int pDegree = curveInfo[1];
int uNoKnots = curveInfo[2];
int uNoControlPoints = curveInfo[3];

double* uKnotVector = new double[uNoKnots];
double* controlPointNet = new double[uNoControlPoints * 4];

serverComm->receiveFromClientBlocking<double>(name, uNoKnots, uKnotVector);
serverComm->receiveFromClientBlocking<double>(name, uNoControlPoints * 4, controlPointNet);

thePatch->addTrimCurve(direction, pDegree, uNoKnots, uKnotVector,
uNoControlPoints, controlPointNet);
} // end curve
} // end trimming loops
thePatch->linearizeTrimming();
} // end isTrimmed
} // end patch

{ // output to shell
DEBUG_OUT() << (*theIGAMesh) << endl;
Expand Down
2 changes: 1 addition & 1 deletion Emperor/src/ClientCode.h
Expand Up @@ -79,7 +79,7 @@ class ClientCode {
/***********************************************************************************************
* \brief Receive the mesh from a real client
* \param[in] meshName name of the mesh to be received
* \author Chenshen Wu
* \author Fabien Pean, Chenshen Wu
***********/
void recvIGAMesh(std::string meshName);
/***********************************************************************************************
Expand Down

0 comments on commit b87c359

Please sign in to comment.