Skip to content

Commit

Permalink
Revert "Merge branch 'capi'"
Browse files Browse the repository at this point in the history
This reverts commit 012eab7, reversing
changes made to 6db1e93.
  • Loading branch information
nwagenbrenner committed Oct 10, 2024
1 parent 012eab7 commit d0da101
Show file tree
Hide file tree
Showing 16 changed files with 85 additions and 1,382 deletions.
12 changes: 0 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,7 @@ endif(WITH_LCP_CLIENT)
#disable for exception handling in the GUI and CLI
option(C_API "Enable WindNinja C API" OFF)
if(C_API)

add_definitions(-DC_API)

endif(C_API)

# Enable phone home and message server startup
Expand Down Expand Up @@ -356,16 +354,6 @@ option(RUN_CFG_TESTS "Run the cfg file tests in autotest/cfg OFF")
if(BUILD_TESTING)
add_subdirectory(autotest)
endif(BUILD_TESTING)
option(SWIG_PYTHON_MODULE "Install Python modules created by SWIG" OFF)
if(SWIG_PYTHON_MODULE)
add_definitions(-DSWIG_PYTHON_MODULE)
add_subdirectory(swig/python)
endif(SWIG_PYTHON_MODULE)
option (SWIG_JAVA_MODULE "Install Java modules created by SWIG" OFF)
if(SWIG_JAVA_MODULE)
add_definitions(-DSWIG_JAVA_MODULE)
add_subdirectory(swig/java)
endif(SWIG_JAVA_MODULE)

# Package related options and settings.
option(PACKAGE_DEBUG "Show some information about the package" OFF)
Expand Down
178 changes: 0 additions & 178 deletions src/examples/api_example.c

This file was deleted.

Binary file removed src/examples/output.tif
Binary file not shown.
2 changes: 0 additions & 2 deletions src/ninja/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,3 @@ target_link_libraries(ninja ${LINK_LIBS})
install(TARGETS ninja DESTINATION lib COMPONENT libs)
install(FILES WindNinjaInputs.h ninja.h windninja.h ninja_errors.h DESTINATION include COMPONENT includes)



80 changes: 15 additions & 65 deletions src/ninja/ninja.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,9 +602,6 @@ if(input.frictionVelocityFlag == 1){
deleteDynamicMemory();
if(!input.keepOutGridsInMemory)
{
u.deallocate();
v.deallocate();
w.deallocate();
AngleGrid.deallocate();
VelocityGrid.deallocate();
CloudGrid.deallocate();
Expand Down Expand Up @@ -2851,7 +2848,9 @@ void ninja::writeOutputFiles()
}
}


u.deallocate();
v.deallocate();
w.deallocate();

#pragma omp parallel sections
{
Expand Down Expand Up @@ -4559,30 +4558,26 @@ void ninja::set_numberCPUs(int CPUs)
//ninjaCom(ninjaComClass::ninjaDebug, "In parallel = %d", omp_in_parallel());
}

double* ninja::get_outputSpeedGrid(double resolution, lengthUnits::eLengthUnits units)
double* ninja::get_outputSpeedGrid()
{
lengthUnits::toBaseUnits(resolution, units);
AsciiGrid<double> *velTempGrid;
velTempGrid = new AsciiGrid<double> (VelocityGrid.resample_Grid(resolution, AsciiGrid<double>::order0));
outputSpeedArray = new double[velTempGrid->get_arraySize()];
for(int i=0; i<velTempGrid->get_nRows(); i++){
for(int j=0; j<velTempGrid->get_nCols(); j++){
outputSpeedArray[i * velTempGrid->get_nCols() + j] = velTempGrid->get_cellValue(i,j);
outputSpeedArray = new double[VelocityGrid.get_arraySize()];

for(int i=0; i<VelocityGrid.get_nRows(); i++){
for(int j=0; j<VelocityGrid.get_nCols(); j++){
outputSpeedArray[i * VelocityGrid.get_nCols() + j] = VelocityGrid(i,j);
}
}

return outputSpeedArray;
}

double* ninja::get_outputDirectionGrid(double resolution, lengthUnits::eLengthUnits units)
double* ninja::get_outputDirectionGrid()
{
lengthUnits::toBaseUnits(resolution, units);
AsciiGrid<double> *dirTempGrid;
dirTempGrid = new AsciiGrid<double> (AngleGrid.resample_Grid(resolution, AsciiGrid<double>::order0));
outputDirectionArray = new double[dirTempGrid->get_arraySize()];
for(int i=0; i<dirTempGrid->get_nRows(); i++){
for(int j=0; j<dirTempGrid->get_nCols(); j++){
outputDirectionArray[i * dirTempGrid->get_nCols() + j] = dirTempGrid->get_cellValue(i,j);
outputDirectionArray = new double[AngleGrid.get_arraySize()];

for(int i=0; i<AngleGrid.get_nRows(); i++){
for(int j=0; j<AngleGrid.get_nCols(); j++){
outputDirectionArray[i * AngleGrid.get_nCols() + j] = AngleGrid(i,j);
}
}

Expand Down Expand Up @@ -4651,51 +4646,6 @@ int ninja::get_outputGridnRows()
{
return input.dem.get_nRows();
}
double * ninja::get_u()
{
double * outputArray = new double[mesh.nrows * mesh.ncols*mesh.nlayers];
for (int i = 0; i < mesh.nrows; i++)
{
for (int j = 0; j < mesh.ncols; j++)
{
for (int k = 0; k < mesh.nlayers; k++)
{
outputArray[i * mesh.ncols * mesh.nlayers + j * mesh.nlayers + k] = u(i,j,k);
}
}
}
return outputArray;
}
double * ninja::get_v()
{
double * outputArray = new double[mesh.nrows * mesh.ncols*mesh.nlayers];
for (int i = 0; i < mesh.nrows; i++)
{
for (int j = 0; j < mesh.ncols; j++)
{
for (int k = 0; k < mesh.nlayers; k++)
{
outputArray[i * mesh.ncols * mesh.nlayers + j * mesh.nlayers + k] = v(i,j,k);
}
}
}
return outputArray;
}
double * ninja::get_w()
{
double * outputArray = new double[mesh.nrows * mesh.ncols*mesh.nlayers];
for (int i = 0; i < mesh.nrows; i++)
{
for (int j = 0; j < mesh.ncols; j++)
{
for (int k = 0; k < mesh.nlayers; k++)
{
outputArray[i * mesh.ncols * mesh.nlayers + j * mesh.nlayers + k] = w(i,j,k);
}
}
}
return outputArray;
}

void ninja::set_outputBufferClipping(double percent)
{
Expand Down
7 changes: 2 additions & 5 deletions src/ninja/ninja.h
Original file line number Diff line number Diff line change
Expand Up @@ -309,17 +309,14 @@ class ninja
void set_position(double lat_degrees, double lat_minutes, double long_degrees, double long_minutes); //input as degrees, decimal minutes
void set_position(double lat_degrees, double lat_minutes, double lat_seconds, double long_degrees, double long_minutes, double long_seconds); //input as degrees, minutes, seconds
void set_numberCPUs(int CPUs);
double *get_outputSpeedGrid(double resolution, lengthUnits::eLengthUnits units);
double *get_outputDirectionGrid(double resolution, lengthUnits::eLengthUnits units);
double *get_outputSpeedGrid();
double *get_outputDirectionGrid();
const char* get_outputGridProjection();
double get_outputGridCellSize();
double get_outputGridxllCorner();
double get_outputGridyllCorner();
int get_outputGridnCols();
int get_outputGridnRows();
double * ninja::get_u();
double * ninja::get_v();
double * ninja::get_w();
void set_outputBufferClipping(double percent);
void set_writeAtmFile(bool flag); //Flag that determines if an atm file should be written. Usually set by ninjaArmy, NOT directly by the user!
void set_googOutFlag(bool flag);
Expand Down
Loading

0 comments on commit d0da101

Please sign in to comment.