Updating macros.cmake to be consistent with other projects, fixing resulting compile errors

This commit is contained in:
Mark Berrill 2015-08-21 16:56:43 -04:00
parent ae11d108ae
commit 4f6bceffc8
35 changed files with 1037 additions and 330 deletions

View File

@ -19,6 +19,9 @@ ENDIF()
# Set the project name
PROJECT( LBPM-WIA )
IF ( NOT CXX_STD )
SET( CXX_STD 98 )
ENDIF()
# Set some common paths
@ -36,6 +39,7 @@ SET( CMAKE_MODULE_PATH ${LBPM_SOURCE_DIR} ${LBPM_SOURCE_DIR}/cmake )
SET( PROJ LBPM )
INCLUDE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/macros.cmake" )
INCLUDE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/libraries.cmake" )
INCLUDE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/LBPM-macros.cmake" )
# Check if we are only compiling docs
@ -56,8 +60,9 @@ INCLUDE( CTest )
ADD_CUSTOM_TARGET( doc )
ADD_CUSTOM_TARGET( latex_docs )
ADD_CUSTOM_TARGET( build-test )
ADD_CUSTOM_TARGET( build-examples )
ADD_CUSTOM_TARGET( check COMMAND make test )
ADD_DISTCLEAN( tests liblbpm-wia.* cpu gpu example common visit IO )
ADD_DISTCLEAN( analysis null_timer tests liblbpm-wia.* cpu gpu example common visit IO )
# Check the compile mode and compile flags
@ -105,6 +110,8 @@ IF ( NOT ONLY_BUILD_DOCS )
CONFIGURE_LINE_COVERAGE()
INCLUDE( "${CMAKE_CURRENT_SOURCE_DIR}/cmake/SharedPtr.cmake" )
CONFIGURE_SHARED_PTR( "${LBPM_INSTALL_DIR}/include" "std" )
# Set the external library link list
SET( EXTERNAL_LIBS ${EXTERNAL_LIBS} ${TIMER_LIBS} )
ENDIF()

View File

@ -14,7 +14,6 @@
/****************************************************
* Pack/unpack data from a buffer *
****************************************************/
// MeshType
template<>
@ -243,7 +242,6 @@ std::vector<MeshDatabase> gatherAll( const std::vector<MeshDatabase>& meshes, MP
{
#ifdef USE_MPI
PROFILE_START("gatherAll");
int rank = MPI_WORLD_RANK();
int size = MPI_WORLD_SIZE();
// First pack the mesh data to local buffers
size_t localsize = 0;

View File

@ -160,7 +160,6 @@ void IO::writeData( int timestep, const std::vector<IO::MeshDataStruct>& meshDat
{
PROFILE_START("writeData");
int rank = MPI_WORLD_RANK();
int size = MPI_WORLD_SIZE();
// Create the output directory
char path[100];
sprintf(path,"vis%03i",timestep);

View File

@ -32,7 +32,7 @@ FUNCTION( CONFIGURE_TIMER DEFAULT_USE_TIMER NULL_TIMER_DIR )
VERIFY_PATH( ${TIMER_DIRECTORY}/lib )
FIND_LIBRARY( TIMER_LIBS NAMES timerutility PATHS ${TIMER_DIRECTORY}/lib NO_DEFAULT_PATH )
SET( TIMER_INCLUDE ${TIMER_DIRECTORY}/include )
SET( TIMER_CXXFLAGS -DUSE_TIMER )
SET( TIMER_CXXFLAGS "-DUSE_TIMER -I${TIMER_DIRECTORY}/include" )
SET( TIMER_LDFLAGS -L${TIMER_DIRECTORY}/lib )
SET( TIMER_LDLIBS -ltimerutility )
ELSE()
@ -40,7 +40,7 @@ FUNCTION( CONFIGURE_TIMER DEFAULT_USE_TIMER NULL_TIMER_DIR )
ENDIF()
SET(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_RPATH} "${TIMER_DIRECTORY}/lib" PARENT_SCOPE )
INCLUDE_DIRECTORIES( "${TIMER_INCLUDE}" )
ADD_DEFINITIONS( "-D USE_TIMER" )
ADD_DEFINITIONS( -DUSE_TIMER )
MESSAGE( "Using timer utility" )
MESSAGE( " TIMER_LIBRARIES = ${TIMER_LIBS}" )
ELSE()

42
cmake/LBPM-macros.cmake Normal file
View File

@ -0,0 +1,42 @@
# Copy an example folder
MACRO( INSTALL_EXAMPLE EXAMPLE )
INSTALL( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE}" DESTINATION "${LBPM_INSTALL_DIR}/example" )
ENDMACRO()
# Create an example test
CONFIGURE_FILE( "${${PROJ}_SOURCE_DIR}/cmake/CompareOutput.cmake" "${${PROJ}_BUILD_DIR}/CompareOutput.cmake" COPYONLY )
MACRO( TEST_EXAMPLE EXAMPLE EXEFILE PROCS ${ARGN} )
SET( EXAMPLE_DIR "${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}" )
# Copy the example directory
ADD_CUSTOM_TARGET(
${EXAMPLE} ALL
${CMAKE_COMMAND} -E copy_directory "${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE}" "${EXAMPLE_DIR}"
DEPENDS ${EXEFILE}
)
# Create a wrapper script to run the test and copy the output to ${EXAMPLE}.out
SET( FILENAME "${EXAMPLE_DIR}/run-${EXAMPLE}" )
FILE(WRITE "${FILENAME}" "# This is a automatically generated file to run example--${EXAMPLE}\n" )
FILE(APPEND "${FILENAME}" "${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} ${PROCS} \"${LBPM_INSTALL_DIR}/bin/${EXEFILE}\" ${ARGN} 2>&1 | tee ${EXAMPLE}.out\n\n" )
# Create the test to run the example
SET( TESTNAME example--${EXAMPLE} )
EXECUTE_PROCESS(COMMAND chmod 755 "${FILENAME}")
ADD_TEST(
NAME ${TESTNAME}
WORKING_DIRECTORY "${EXAMPLE_DIR}"
COMMAND "${FILENAME}"
)
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGULAR_EXPRESSION}" PROCESSORS ${PROCS} )
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES RESOURCE_LOCK ${EXEFILE} )
# Create a test that checks the output against the data in EXAMPLE/OutputAns.txt
IF ( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${EXAMPLE}/ExampleOutput.txt" )
ADD_TEST(
NAME ${TESTNAME}-output
WORKING_DIRECTORY "${EXAMPLE_DIR}"
COMMAND ${CMAKE_COMMAND} -DTEST=${EXAMPLE}.out -DGOLD=ExampleOutput.txt -P "${${PROJ}_BUILD_DIR}/CompareOutput.cmake"
)
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES FAIL_REGULAR_EXPRESSION "${TEST_FAIL_REGULAR_EXPRESSION}" PROCESSORS 1 )
SET_TESTS_PROPERTIES( ${TESTNAME} PROPERTIES DEPENDS ${TESTNAME} )
ENDIF()
ENDMACRO()

View File

@ -86,15 +86,28 @@ MACRO( CONFIGURE_MPI )
IF ( USE_MPI )
# Check if we specified the MPI directory
IF ( MPI_DIRECTORY )
# Check the provided MPI directory for include files and the mpi executable
VERIFY_PATH ( ${MPI_DIRECTORY} )
SET ( MPI_INCLUDE_PATH ${MPI_DIRECTORY}/include )
VERIFY_PATH ( ${MPI_INCLUDE_PATH} )
IF ( NOT EXISTS ${MPI_INCLUDE_PATH}/mpi.h )
MESSAGE( FATAL_ERROR "mpi.h not found in ${MPI_INCLUDE_PATH}" )
# Check the provided MPI directory for include files
VERIFY_PATH( "${MPI_DIRECTORY}" )
IF ( EXISTS "${MPI_DIRECTORY}/include/mpi.h" )
SET( MPI_INCLUDE_PATH "${MPI_DIRECTORY}/include" )
ELSEIF ( EXISTS "${MPI_DIRECTORY}/Inc/mpi.h" )
SET( MPI_INCLUDE_PATH "${MPI_DIRECTORY}/Inc" )
ELSE()
MESSAGE( FATAL_ERROR "mpi.h not found in ${MPI_DIRECTORY}/include" )
ENDIF ()
INCLUDE_DIRECTORIES ( ${MPI_INCLUDE_PATH} )
SET ( MPI_INCLUDE ${MPI_INCLUDE_PATH} )
# Set MPI libraries
IF ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
FIND_LIBRARY( MSMPI_LIB NAMES msmpi PATHS "${MPI_DIRECTORY}/Lib/x64" NO_DEFAULT_PATH )
FIND_LIBRARY( MSMPI_LIB NAMES msmpi PATHS "${MPI_DIRECTORY}/Lib/amd64" NO_DEFAULT_PATH )
FIND_LIBRARY( MSMPIFEC_LIB NAMES msmpifec PATHS "${MPI_DIRECTORY}/Lib/x64" NO_DEFAULT_PATH )
FIND_LIBRARY( MSMPIFEC_LIB NAMES msmpifec PATHS "${MPI_DIRECTORY}/Lib/amd64" NO_DEFAULT_PATH )
FIND_LIBRARY( MSMPIFMC_LIB NAMES msmpifmc PATHS "${MPI_DIRECTORY}/Lib/x64" NO_DEFAULT_PATH )
FIND_LIBRARY( MSMPIFMC_LIB NAMES msmpifmc PATHS "${MPI_DIRECTORY}/Lib/amd64" NO_DEFAULT_PATH )
SET( MPI_LIBRARIES ${MSMPI_LIB} ${MSMPIFEC_LIB} ${MSMPIFMC_LIB} )
ENDIF()
# Set the mpi executable
IF ( MPIEXEC )
# User specified the MPI command directly, use as is
ELSEIF ( MPIEXEC_CMD )
@ -116,14 +129,20 @@ MACRO( CONFIGURE_MPI )
ENDIF()
ELSEIF ( MPI_COMPILER )
# The mpi compiler should take care of everything
IF ( MPI_INCLUDE )
INCLUDE_DIRECTORIES( ${MPI_INCLUDE} )
ENDIF()
ELSE()
# Perform the default search for MPI
INCLUDE ( FindMPI )
IF ( NOT MPI_FOUND )
MESSAGE( " MPI_INCLUDE = ${MPI_INCLUDE}" )
MESSAGE( " MPI_LINK_FLAGS = ${MPI_LINK_FLAGS}" )
MESSAGE( " MPI_LIBRARIES = ${MPI_LIBRARIES}" )
MESSAGE( FATAL_ERROR "Did not find MPI" )
ENDIF ()
INCLUDE_DIRECTORIES ( ${MPI_INCLUDE_PATH} )
SET ( MPI_INCLUDE ${MPI_INCLUDE_PATH} )
INCLUDE_DIRECTORIES( "${MPI_INCLUDE_PATH}" )
SET( MPI_INCLUDE "${MPI_INCLUDE_PATH}" )
ENDIF()
# Check if we need to use MPI for serial tests
CHECK_ENABLE_FLAG( USE_MPI_FOR_SERIAL_TESTS 0 )
@ -132,12 +151,10 @@ MACRO( CONFIGURE_MPI )
SET( MPIEXEC mpirun )
ENDIF()
IF ( NOT MPIEXEC_NUMPROC_FLAG )
SET(MPIEXEC_NUMPROC_FLAG "-n")
SET( MPIEXEC_NUMPROC_FLAG "-np" )
ENDIF()
# Check if we need to use MPI for serial tests
SET( MPI_CXXFLAGS -DUSE_MPI -I${MPI_INCLUDE} )
# Set the definitions
ADD_DEFINITIONS( "-D USE_MPI" )
ADD_DEFINITIONS( "-DUSE_MPI" )
MESSAGE( "Using MPI" )
MESSAGE( " MPIEXEC = ${MPIEXEC}" )
MESSAGE( " MPIEXEC_NUMPROC_FLAG = ${MPIEXEC_NUMPROC_FLAG}" )
@ -170,12 +187,8 @@ MACRO( CONFIGURE_SYSTEM )
ENDIF()
# Remove extra library links
# Get the compiler
SET_COMPILER ()
IDENTIFY_COMPILER()
CHECK_ENABLE_FLAG( USE_STATIC 0 )
IF ( USE_STATIC )
SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-static") # Add static flag
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-static") # Add static flag
ENDIF()
# Add system dependent flags
MESSAGE("System is: ${CMAKE_SYSTEM_NAME}")
IF ( ${CMAKE_SYSTEM_NAME} STREQUAL "Windows" )
@ -201,7 +214,12 @@ MACRO( CONFIGURE_SYSTEM )
# Linux specific system libraries
SET( SYSTEM_LIBS -lz -lpthread -ldl )
IF ( NOT USE_STATIC )
SET( SYSTEM_LDFLAGS ${SYSTEM_LDFLAGS} -rdynamic ) # Needed for backtrace to print function names
# Try to add rdynamic so we have names in backtrace
SET( CMAKE_REQUIRED_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS} -rdynamic" )
CHECK_CXX_SOURCE_COMPILES( "int main() { return 0;}" rdynamic )
IF ( rdynamic )
SET( SYSTEM_LDFLAGS ${SYSTEM_LDFLAGS} -rdynamic )
ENDIF()
ENDIF()
IF ( USING_GCC )
SET( SYSTEM_LIBS ${SYSTEM_LIBS} -lgfortran )
@ -217,7 +235,13 @@ MACRO( CONFIGURE_SYSTEM )
MESSAGE( FATAL_ERROR "OS not detected" )
ENDIF()
# Set the compile flags based on the build
SET_COMPILE_FLAGS()
SET_COMPILER_FLAGS()
# Add the static flag if necessary
IF ( USE_STATIC )
SET_STATIC_FLAGS()
ENDIF()
# Print some flags
MESSAGE( "LDLIBS = ${LDLIBS}" )
ENDMACRO ()

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,12 @@
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <Array.h>
#include <math.h>
#include <time.h>
#include <exception> // std::exception
#include <stdexcept>
#include "common/Array.h"
#include "common/Utilities.h"
#include "common/MPI_Helpers.h"
#include "common/Communication.h"
@ -788,9 +788,9 @@ inline void SSO(DoubleArray &Distance, char *ID, Domain &Dm, int timesteps){
*/
int Q=26;
int q,i,j,k,n;
int q,i,j,k;
double dt=0.1;
int in,jn,kn,nn;
int in,jn,kn;
double Dqx,Dqy,Dqz,Dx,Dy,Dz,W;
double nx,ny,nz,Cqx,Cqy,Cqz,sign,norm;
@ -822,7 +822,6 @@ inline void SSO(DoubleArray &Distance, char *ID, Domain &Dm, int timesteps){
for (j=1;j<Dm.Ny-1;j++){
for (i=1;i<Dm.Nx-1;i++){
n = k*Dm.Nx*Dm.Ny+j*Dm.Nx+i;
sign = Distance(i,j,k) / fabs(Distance(i,j,k));
/*
@ -929,7 +928,7 @@ inline void ReadSpherePacking(int nspheres, double *List_cx, double *List_cy, do
//........read the spheres..................
// We will read until a blank like or end-of-file is reached
int count = 0;
while ( !feof(fid) && fgets(line,100,fid)>0 ) {
while ( !feof(fid) && fgets(line,100,fid)!=NULL ) {
char* line2 = line;
List_cx[count] = strtod(line2,&line2);
List_cy[count] = strtod(line2,&line2);

View File

@ -285,9 +285,9 @@ public:
void TwoPhase::ColorToSignedDistance(double Beta, DoubleArray &ColorData, DoubleArray &DistData){
double factor,temp,value;
/* double factor,temp,value;
factor=0.5/Beta;
/* for (int n=0; n<Nx*Ny*Nz; n++){
for (int n=0; n<Nx*Ny*Nz; n++){
value = ColorData[n];
if (value > 0.999 ) DistData[n] = 4.0;
else if (value < -0.999 ) DistData[n] = -4.0;
@ -568,7 +568,7 @@ void TwoPhase::ComputeLocal(){
void TwoPhase::AssignComponentLabels(){
int LabelNWP=1;
int LabelWP=2;
//int LabelWP=2;
// NOTE: labeling the wetting phase components is tricky! One sandstone media had over 800,000 components
//NumberComponents_WP = ComputeGlobalPhaseComponent(Dm.Nx-2,Dm.Ny-2,Dm.Nz-2,Dm.rank_info,PhaseID,LabelWP,Label_WP);
// treat all wetting phase is connected
@ -826,6 +826,7 @@ void TwoPhase::ComponentAverages(){
van(1) = ComponentAverages_NWP(VY,b)/Vn;
van(2) = ComponentAverages_NWP(VZ,b)/Vn;
vsq = ComponentAverages_NWP(VSQ,b)/Vn;
NULL_USE(ans);
if (ComponentAverages_NWP(TRIMVOL,b) > 0.0){
pn = ComponentAverages_NWP(PRS,b)/ComponentAverages_NWP(TRIMVOL,b);
@ -910,6 +911,7 @@ void TwoPhase::ComponentAverages(){
vaw(1) = ComponentAverages_WP(VY,b)/Vw;
vaw(2) = ComponentAverages_WP(VZ,b)/Vw;
vsq = ComponentAverages_WP(VSQ,b)/Vw;
NULL_USE(ans);
if (ComponentAverages_WP(TRIMVOL,b) > 0.0){
pw = ComponentAverages_WP(PRS,b)/ComponentAverages_WP(TRIMVOL,b);
@ -975,7 +977,7 @@ void TwoPhase::ComponentAverages(){
void TwoPhase::WriteSurfaces(int logcount){
int i,j,k,n;
int i,j,k;
int ncubes=(Nx-1)*(Ny-1)*(Nz-1);
Point P,A,B,C;
@ -1214,7 +1216,7 @@ void TwoPhase::PrintAll(int timestep){
void TwoPhase::PrintComponents(int timestep){
if (Dm.rank==0){
printf("PRINT %i COMPONENT AVEREAGES: time = %i \n",ComponentAverages_NWP.size(1),timestep);
printf("PRINT %i COMPONENT AVEREAGES: time = %i \n",(int)ComponentAverages_NWP.size(1),timestep);
for (int b=0; b<NumberComponents_NWP; b++){
if (ComponentAverages_NWP(TRIMVOL,b) > 0.0){
fprintf(NWPLOG,"%i ",timestep-5);

36
example/examples.h Normal file
View File

@ -0,0 +1,36 @@
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"
* \ref Bubble "Bubble"
* \ref Sph1896 "Sph1896"
* \ref ConstrainedBubble "ConstrainedBubble"

View File

@ -6,10 +6,10 @@
#include <stdexcept>
#include <fstream>
#include "pmmc.h"
#include "ScaLBL.h"
#include "common/pmmc.h"
#include "common/ScaLBL.h"
#include "common/MPI_Helpers.h"
#include "Communication.h"
#include "common/Communication.h"
//#define CBUB
//#define WRITE_SURFACES
@ -123,14 +123,13 @@ int main(int argc, char **argv)
// Variables that specify the computational domain
string FILENAME;
unsigned int nBlocks, nthreads;
int Nx,Ny,Nz; // local sub-domain size
int nspheres; // number of spheres in the packing
double Lx,Ly,Lz; // Domain length
double D = 1.0; // reference length for non-dimensionalization
// Color Model parameters
int timestepMax, interval;
double tau,Fx,Fy,Fz,tol,err;
double tau,Fx,Fy,Fz,tol;
double alpha, beta;
double das, dbs, phi_s;
double din,dout;
@ -146,8 +145,6 @@ int main(int argc, char **argv)
int SimCount; // Number of simulations is 2 x SimCount
double SimDelta; // Percent differenc between force pairs
int RESTART_INTERVAL=20000;
if (rank==0){
//.............................................................
// READ SIMULATION PARMAETERS FROM INPUT FILE
@ -232,7 +229,8 @@ int main(int argc, char **argv)
//.................................................
MPI_Barrier(MPI_COMM_WORLD);
RESTART_INTERVAL=interval;
//int RESTART_INTERVAL=interval;
// **************************************************************
// **************************************************************
double Ps = -(das-dbs)/(das+dbs);
@ -1462,7 +1460,6 @@ int main(int argc, char **argv)
}
}
err = 1.0;
sat_w_previous = 1.01; // slightly impossible value!
if (rank==0) printf("Begin timesteps: error tolerance is %f \n", tol);
for (int SimNumber=0; SimNumber < 2*SimCount; SimNumber++){

View File

@ -1,21 +1,21 @@
# Copy files for the tests
INSTALL_LBPM_EXE( lb2_Color_wia_mpi )
INSTALL_LBPM_EXE( lbpm_permeability_simulator )
INSTALL_LBPM_EXE( lbpm_color_simulator )
INSTALL_LBPM_EXE( lbpm_sphere_pp )
INSTALL_LBPM_EXE( lbpm_random_pp )
INSTALL_LBPM_EXE( lbpm_segmented_pp )
INSTALL_LBPM_EXE( lbpm_segmented_decomp )
INSTALL_LBPM_EXE( lbpm_disc_pp )
INSTALL_LBPM_EXE( lbpm_captube_pp )
INSTALL_LBPM_EXE( lbpm_BlobAnalysis )
INSTALL_LBPM_EXE( TestBubble )
INSTALL_LBPM_EXE( BasicSimulator )
INSTALL_LBPM_EXE( ComponentLabel )
INSTALL_LBPM_EXE( BlobAnalysis )
INSTALL_LBPM_EXE( BlobIdentify )
INSTALL_LBPM_EXE( BlobIdentifyParallel )
#INSTALL_LBPM_EXE( BlobAnalyzeParallel )
ADD_LBPM_EXECUTABLE( lb2_Color_wia_mpi )
ADD_LBPM_EXECUTABLE( lbpm_permeability_simulator )
ADD_LBPM_EXECUTABLE( lbpm_color_simulator )
ADD_LBPM_EXECUTABLE( lbpm_sphere_pp )
ADD_LBPM_EXECUTABLE( lbpm_random_pp )
ADD_LBPM_EXECUTABLE( lbpm_segmented_pp )
ADD_LBPM_EXECUTABLE( lbpm_segmented_decomp )
ADD_LBPM_EXECUTABLE( lbpm_disc_pp )
ADD_LBPM_EXECUTABLE( lbpm_captube_pp )
ADD_LBPM_EXECUTABLE( lbpm_BlobAnalysis )
ADD_LBPM_EXECUTABLE( TestBubble )
ADD_LBPM_EXECUTABLE( BasicSimulator )
ADD_LBPM_EXECUTABLE( ComponentLabel )
ADD_LBPM_EXECUTABLE( BlobAnalysis )
ADD_LBPM_EXECUTABLE( BlobIdentify )
ADD_LBPM_EXECUTABLE( BlobIdentifyParallel )
#ADD_LBPM_EXECUTABLE( BlobAnalyzeParallel )
CONFIGURE_FILE( ${CMAKE_CURRENT_SOURCE_DIR}/cylindertest ${CMAKE_CURRENT_BINARY_DIR}/cylindertest COPYONLY )

View File

@ -6,7 +6,7 @@
#include <iostream>
#include <math.h>
#include "analysis/analysis.h"
#include "TwoPhase.h"
#include "common/TwoPhase.h"
#define NUM_AVERAGES 30
@ -198,7 +198,7 @@ int main(int argc, char **argv)
int nspheres;
double Lx,Ly,Lz;
//.......................................................................
int i,j,k,n,p,idx;
int i,j,k,n;
int iproc,jproc,kproc;
//.......................................................................
// Reading the domain information file

View File

@ -7,10 +7,7 @@
#include <math.h>
#include "common/Communication.h"
#include "analysis/analysis.h"
#ifdef PROFILE
#include "ProfilerApp.h"
#endif
#include "TwoPhase.h"
#include "common/TwoPhase.h"
//#include "Domain.h"

View File

@ -0,0 +1,124 @@
// Test of ComputeGlobalBlobIDs for special corner/edge cases
// Note: this is a short test, but requires 27 processors to run
#include <iostream>
#include <math.h>
#include "common/pmmc.h"
#include "common/Communication.h"
#include "analysis/analysis.h"
#include "IO/MeshDatabase.h"
#include "IO/Reader.h"
#include "IO/Writer.h"
#include "ProfilerApp.h"
// Main
int main(int argc, char **argv)
{
// Initialize MPI
int rank, nprocs;
MPI_Init(&argc,&argv);
MPI_Comm_rank(MPI_COMM_WORLD,&rank);
MPI_Comm_size(MPI_COMM_WORLD,&nprocs);
/*if ( nprocs != 8 ) {
printf("This tests requires 8 processors\n");
return -1;
}*/
if ( rank==0 ) {
printf("-----------------------------------------------------------\n");
printf("Testing Blob Identification Special Cases\n");
printf("-----------------------------------------------------------\n");
}
// Set the domain information
std::vector<int> factors = Utilities::factor(nprocs);
int nproc[3]={1,1,1};
for (size_t i=0; i<factors.size(); i++)
nproc[i%3] *= factors[i];
const int nx = 4;
const int ny = 4;
const int nz = 4;
double Lx=1.0, Ly=1.0, Lz=1.0;
// Get the rank info
const RankInfoStruct rank_info(rank,nproc[0],nproc[1],nproc[2]);
const int rankx = rank_info.ix;
const int ranky = rank_info.jy;
const int rankz = rank_info.kz;
// Test that local blobs that only touch at edges/corners do not share global ids
DoubleArray Phase(nx+2,ny+2,nz+2);
DoubleArray SignDist(nx+2,ny+2,nz+2);
Phase.fill(1);
SignDist.fill(1);
// First block
SignDist(1,1,1)=-1; SignDist(2,1,1)=-1; SignDist(1,2,1)=-1; SignDist(2,2,1)=-1;
SignDist(1,1,2)=-1; SignDist(2,1,2)=-1; SignDist(1,2,2)=-1; SignDist(2,2,2)=-1;
// Second block
SignDist(3,3,1)=-1; SignDist(4,3,1)=-1; SignDist(3,4,1)=-1; SignDist(4,4,1)=-1;
SignDist(3,3,2)=-1; SignDist(4,3,2)=-1; SignDist(3,4,2)=-1; SignDist(4,4,2)=-1;
// Third block
SignDist(3,1,3)=-1; SignDist(4,1,3)=-1; SignDist(3,2,3)=-1; SignDist(4,2,3)=-1;
SignDist(3,1,4)=-1; SignDist(4,1,4)=-1; SignDist(3,2,4)=-1; SignDist(4,2,4)=-1;
// Fourth block
SignDist(1,3,3)=-1; SignDist(1,4,3)=-1; SignDist(2,3,3)=-1; SignDist(2,4,3)=-1;
SignDist(1,3,4)=-1; SignDist(1,4,4)=-1; SignDist(2,3,4)=-1; SignDist(2,4,4)=-1;
// Communication the halos
fillHalo<double> fillData(rank_info,nx,ny,nz,1,1,1,0,1);
fillData.fill(Phase);
fillData.fill(SignDist);
// Find blob domains
if ( rank==0 ) { printf("Finding blob domains\n"); }
double vF=0.0;
double vS=0.0;
IntArray LocalBlobID, GlobalBlobID;
int nblobs0 = ComputeLocalBlobIDs(Phase,SignDist,vF,vS,LocalBlobID,false);
int nblobs = ComputeGlobalBlobIDs(nx,ny,nz,rank_info,
Phase,SignDist,vF,vS,GlobalBlobID);
if ( rank==0 ) { printf("Identified %i blobs\n",nblobs); }
// Create the MeshDataStruct
std::vector<IO::MeshDataStruct> meshData(1);
meshData[0].meshName = "domain";
meshData[0].mesh = std::shared_ptr<IO::DomainMesh>( new IO::DomainMesh(rank_info,nx,ny,nz,Lx,Ly,Lz) );
std::shared_ptr<IO::Variable> PhaseVar( new IO::Variable() );
std::shared_ptr<IO::Variable> SignDistVar( new IO::Variable() );
std::shared_ptr<IO::Variable> LocalBlobIDVar( new IO::Variable() );
std::shared_ptr<IO::Variable> GlobalBlobIDVar( new IO::Variable() );
PhaseVar->name = "phase";
PhaseVar->type = IO::VolumeVariable;
PhaseVar->dim = 1;
PhaseVar->data.resize(nx,ny,nz);
meshData[0].vars.push_back(PhaseVar);
SignDistVar->name = "SignDist";
SignDistVar->type = IO::VolumeVariable;
SignDistVar->dim = 1;
SignDistVar->data.resize(nx,ny,nz);
meshData[0].vars.push_back(SignDistVar);
LocalBlobIDVar->name = "LocalBlobID";
LocalBlobIDVar->type = IO::VolumeVariable;
LocalBlobIDVar->dim = 1;
LocalBlobIDVar->data.resize(nx,ny,nz);
meshData[0].vars.push_back(LocalBlobIDVar);
GlobalBlobIDVar->name = "GlobalBlobID";
GlobalBlobIDVar->type = IO::VolumeVariable;
GlobalBlobIDVar->dim = 1;
GlobalBlobIDVar->data.resize(nx,ny,nz);
meshData[0].vars.push_back(GlobalBlobIDVar);
// Save the results
fillData.copy(Phase,PhaseVar->data);
fillData.copy(SignDist,SignDistVar->data);
fillData.copy(LocalBlobID,LocalBlobIDVar->data);
fillData.copy(GlobalBlobID,GlobalBlobIDVar->data);
IO::writeData( 0, meshData, 2 );
int N_errors = 0;
return N_errors;
}

View File

@ -5,10 +5,10 @@
#include <stdexcept>
#include <fstream>
#include "pmmc.h"
#include "ScaLBL.h"
#include "common/pmmc.h"
#include "common/ScaLBL.h"
#include "common/MPI_Helpers.h"
#include "Communication.h"
#include "common/Communication.h"
#include "IO/Mesh.h"
#include "IO/Writer.h"
#include "ProfilerApp.h"

View File

@ -5,7 +5,7 @@
#include <stdio.h>
#include <iostream>
#include <fstream>
#include "ScaLBL.h"
#include "common/ScaLBL.h"
#include "common/MPI_Helpers.h"
using namespace std;

View File

@ -1,8 +1,8 @@
#include <iostream>
#include <math.h>
#include "pmmc.h"
//#include "PointList.h"
//#include "Array.h"
#include "common/pmmc.h"
//#include "common/PointList.h"
//#include "common/Array.h"
#define RADIUS 15
#define CAPRAD 20

View File

@ -1,8 +1,8 @@
#include <iostream>
#include <math.h>
#include "pmmc.h"
//#include "PointList.h"
//#include "Array.h"
#include "common/pmmc.h"
//#include "common/PointList.h"
//#include "common/Array.h"
#define RADIUS 15
#define HEIGHT 15.5

View File

@ -1,9 +1,9 @@
#include <iostream>
#include <math.h>
#include "TwoPhase.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
#include "Communication.h"
#include "common/Communication.h"
#include "IO/Mesh.h"
#include "IO/Writer.h"
#include "ProfilerApp.h"

View File

@ -7,9 +7,9 @@
#include <stdexcept>
#include <fstream>
#include "ScaLBL.h"
#include "Communication.h"
#include "TwoPhase.h"
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
int main(int argc, char **argv)

View File

@ -9,8 +9,8 @@
#include <math.h>
#include <iostream>
#include <fstream>
#include <Array.h>
#include <Domain.h>
#include "common/Array.h"
#include "common/Domain.h"
int main(int argc, char **argv)
{

View File

@ -1,7 +1,7 @@
#include <iostream>
#include <math.h>
#include "pmmc.h"
#include "Domain.h"
#include "common/pmmc.h"
#include "common/Domain.h"
using namespace std;

View File

@ -7,9 +7,9 @@
#include <stdexcept>
#include <fstream>
#include "TwoPhase.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
#include "Communication.h"
#include "common/Communication.h"
#include "IO/Mesh.h"
#include "IO/Writer.h"
#include "ProfilerApp.h"

View File

@ -6,9 +6,9 @@
#include <stdexcept>
#include <fstream>
#include "ScaLBL.h"
#include "Communication.h"
#include "TwoPhase.h"
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
#ifndef CBUB
@ -1065,7 +1065,7 @@ int main(int argc, char **argv)
UnpackID(recvList_YZ, recvCount_YZ ,recvID_YZ, id);
//......................................................................................
// Fill in the phase MeshData from neighboring processors
double *sendMeshData_x, *sendMeshData_y, *sendMeshData_z, *sendMeshData_X, *sendMeshData_Y, *sendMeshData_Z;
/*double *sendMeshData_x, *sendMeshData_y, *sendMeshData_z, *sendMeshData_X, *sendMeshData_Y, *sendMeshData_Z;
double *sendMeshData_xy, *sendMeshData_yz, *sendMeshData_xz, *sendMeshData_Xy, *sendMeshData_Yz, *sendMeshData_xZ;
double *sendMeshData_xY, *sendMeshData_yZ, *sendMeshData_Xz, *sendMeshData_XY, *sendMeshData_YZ, *sendMeshData_XZ;
double *recvMeshData_x, *recvMeshData_y, *recvMeshData_z, *recvMeshData_X, *recvMeshData_Y, *recvMeshData_Z;
@ -1109,7 +1109,7 @@ int main(int argc, char **argv)
recvMeshData_Xz = new double [recvCount_Xz];
recvMeshData_XY = new double [recvCount_XY];
recvMeshData_YZ = new double [recvCount_YZ];
recvMeshData_XZ = new double [recvCount_XZ];
recvMeshData_XZ = new double [recvCount_XZ];*/
if (rank==0) printf ("Devices are ready to communicate. \n");
MPI_Barrier(MPI_COMM_WORLD);

View File

@ -12,8 +12,8 @@ James E. McClure 2015
#include <stdexcept>
#include <fstream>
#include "Domain.h"
#include "TwoPhase.h"
#include "common/Domain.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
#include "common/Utilities.h"

View File

@ -6,9 +6,9 @@
#include <stdexcept>
#include <fstream>
#include "ScaLBL.h"
#include "Communication.h"
#include "TwoPhase.h"
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
int main(int argc, char **argv)

View File

@ -6,9 +6,9 @@
#include <stdexcept>
#include <fstream>
#include "ScaLBL.h"
#include "Communication.h"
#include "TwoPhase.h"
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
#include "ProfilerApp.h"

View File

@ -6,10 +6,10 @@
#include <stdexcept>
#include <fstream>
#include "pmmc.h"
#include "Domain.h"
#include "Communication.h"
#include "MPI_Helpers.h" // This includes mpi.h
#include "common/pmmc.h"
#include "common/Domain.h"
#include "common/Communication.h"
#include "common/MPI_Helpers.h" // This includes mpi.h
/*

View File

@ -6,9 +6,9 @@
#include <stdexcept>
#include <fstream>
#include "ScaLBL.h"
#include "Communication.h"
#include "TwoPhase.h"
#include "common/ScaLBL.h"
#include "common/Communication.h"
#include "common/TwoPhase.h"
#include "common/MPI_Helpers.h"
//#define WRITE_SURFACES

View File

@ -9,8 +9,8 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <Array.h>
#include <Domain.h>
#include "common/Array.h"
#include "common/Domain.h"
inline void FlipID(char *ID, int N)
{

View File

@ -10,8 +10,8 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <Array.h>
#include <Domain.h>
#include "common/Array.h"
#include "common/Domain.h"
int main(int argc, char **argv)
{

View File

@ -9,9 +9,9 @@
#include <iostream>
#include <fstream>
#include <sstream>
#include <Array.h>
#include <Domain.h>
#include <TwoPhase.h>
#include "common/Array.h"
#include "common/Domain.h"
#include "common/TwoPhase.h"
inline void MeanFilter(DoubleArray &Mesh){
for (int k=1; k<(int)Mesh.size(2)-1; k++){

View File

@ -6,10 +6,10 @@
#include <stdexcept>
#include <fstream>
#include "pmmc.h"
#include "Domain.h"
#include "common/pmmc.h"
#include "common/Domain.h"
#include "common/MPI_Helpers.h"
#include "Communication.h"
#include "common/Communication.h"
/*
* Pre-Processor to generate signed distance function from sphere packing

View File

@ -1,8 +1,8 @@
#include <iostream>
#include <math.h>
#include "pmmc.h"
//#include "PointList.h"
//#include "Array.h"
#include "common/pmmc.h"
//#include "common/PointList.h"
//#include "common/Array.h"
#define RADIUS 15
#define HEIGHT 15.5