Commit 4601f4e3 authored by Gaurav Saxena's avatar Gaurav Saxena

Project BEFORE changing SOLVER

parents
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#ifndef __BioFVM_h__
#define __BioFVM_h__
#include <iostream>
#include <fstream>
namespace BioFVM{
extern std::string BioFVM_Version;
extern std::string BioFVM_URL;
};
#include "BioFVM_utilities.h"
#include "BioFVM_vector.h"
#include "BioFVM_vector.h"
#include "BioFVM_mesh.h"
#include "BioFVM_microenvironment.h"
#include "BioFVM_solvers.h"
#include "BioFVM_basic_agent.h"
#endif
This diff is collapsed.
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#ifndef __BioFVM_MultiCellDS_h__
#define __BioFVM_MultiCellDS_h__
#include "pugixml.hpp"
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <ctime>
#include <cstring>
#include <vector>
#include <fstream>
namespace BioFVM{
extern std::string MultiCellDS_version_string;
extern std::string MultiCellDS_clinical_snapshot_type_string;
extern int MultiCellDS_clinical_snapshot_code;
extern std::string MultiCellDS_experimental_snapshot_type_string;
extern int MultiCellDS_experimental_snapshot_code;
extern std::string MultiCellDS_simulation_snapshot_type_string;
extern int MultiCellDS_simulation_snapshot_code;
extern std::string MultiCellDS_digital_cell_line_type_string;
extern int MultiCellDS_digital_cell_line_code;
/* options */
extern bool save_mesh_as_matlab;
extern bool save_density_data_as_matlab;
extern bool save_cells_as_custom_matlab;
extern bool save_cell_data;
class Microenvironment;
extern pugi::xml_document biofvm_doc;
class Person_Metadata
{
private:
bool is_empty;
public:
std::string type; // author, creator, user, curator
std::string surname;
std::string given_names;
std::string email;
std::string URL;
std::string organization;
std::string department;
std::string ORCID;
Person_Metadata( );
void display_information( std::ostream& os );
void insert_in_open_xml_pugi( pugi::xml_node& insert_here );
};
class Citation_Metadata
{
private:
public:
std::string DOI;
std::string PMID;
std::string PMCID;
std::string text;
std::string notes;
std::string URL;
Citation_Metadata();
void display_information( std::ostream& os );
void insert_in_open_xml_pugi( pugi::xml_node& insert_here );
};
class Software_Metadata
{
private:
public:
// basic program information
std::string program_name;
std::string program_version;
std::string program_URL;
Person_Metadata creator;
Person_Metadata user;
Citation_Metadata citation;
Software_Metadata();
void display_information( std::ostream& os );
void insert_in_open_xml_pugi( pugi::xml_node& insert_here );
};
class MultiCellDS_Metadata
{
private:
public:
std::string MultiCellDS_type;
Software_Metadata program;
Citation_Metadata data_citation;
// scientific information
std::string spatial_units;
std::string time_units;
std::string runtime_units;
double current_time;
double current_runtime;
std::string description; // any optional text -- not implemented
MultiCellDS_Metadata();
void display_information( std::ostream& os);
void sync_to_microenvironment( Microenvironment& M );
void restart_runtime( void );
void add_to_open_xml_pugi( double current_simulation_time, pugi::xml_document& xml_dom );
};
extern MultiCellDS_Metadata BioFVM_metadata;
/* setting up the main MultiCellDS tree structure */
void add_MultiCellDS_main_structure_to_open_xml_pugi( pugi::xml_document& xml_dom );
/* set options */
void set_save_biofvm_mesh_as_matlab( bool newvalue ); // default: true
void set_save_biofvm_data_as_matlab( bool newvalue ); // default: true
void set_save_biofvm_cell_data( bool newvalue ); // default: true
void set_save_biofvm_cell_data_as_custom_matlab( bool newvalue ); // default: true
/* writing parts of BioFVM to a MultiCellDS file */
void add_BioFVM_substrates_to_open_xml_pugi( pugi::xml_document& xml_dom , std::string filename_base , Microenvironment& M );
void add_BioFVM_basic_agent_to_open_xml_pugi( pugi::xml_document& xml_dom, Basic_Agent& BA ); // not implemented -- future edition
void add_BioFVM_agents_to_open_xml_pugi( pugi::xml_document& xml_dom, std::string filename_base, Microenvironment& M );
void add_BioFVM_to_open_xml_pugi( pugi::xml_document& xml_dom , std::string filename_base, double current_simulation_time , Microenvironment& M );
void save_BioFVM_to_MultiCellDS_xml_pugi( std::string filename_base , Microenvironment& M , double current_simulation_time);
/* future / not yet supported */
void read_BioFVM_from_open_xml_pugi( pugi::xml_document& xml_dom , std::string filename_base, double& current_simulation_time , Microenvironment& M );
void read_BioFVM_to_MultiCellDS_xml_pugi( std::string filename_base , Microenvironment& M , double& current_simulation_time );
/* partly-implemented code snippets -- not to be used as of March 2016 */
// functions to read multiscale_microenvironment from MultiCellDS file (requires pugixml)
void read_microenvironment_from_MultiCellDS_xml( Microenvironment& M_destination , std::string filename );
void read_microenvironment_from_MultiCellDS_xml( Microenvironment& M_destination , pugi::xml_document& xml_dom );
};
#endif
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#include "BioFVM_agent_container.h"
#include "BioFVM_basic_agent.h"
#include "BioFVM_vector.h"
namespace BioFVM{
Agent_Container::Agent_Container(){}
void Agent_Container::initialize(int num_voxels){}
void Agent_Container::register_agent( Basic_Agent* agent ){}
void Agent_Container::remove_agent(Basic_Agent* agent ){}
void Agent_Container::add_agent_to_outer_voxel(Basic_Agent* agent){}
void Agent_Container::remove_agent_from_voxel(Basic_Agent* agent, int voxel_index){}
void Agent_Container::add_agent_to_voxel(Basic_Agent* agent, int voxel_index){}
void Agent_Container::update_all_cells(double dt){}
};
\ No newline at end of file
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#ifndef __BioFVM_agent_container_h__
#define __BioFVM_agent_container_h__
#include <vector>
namespace BioFVM{
class Basic_Agent;
class Microenvironment;
class Agent_Container
{
private:
public:
std::vector<std::vector<Basic_Agent*> > agent_grid;
Agent_Container();
void register_agent( Basic_Agent* agent );
void initialize( int num_voxels );
void remove_agent(Basic_Agent* agent );
void add_agent_to_outer_voxel(Basic_Agent* agent);
void remove_agent_from_voxel(Basic_Agent* agent, int voxel_index);
void add_agent_to_voxel(Basic_Agent* agent, int voxel_index);
void update_all_cells(double dt);
};
int find_escaping_face_index(Basic_Agent* agent);
};
#endif
This diff is collapsed.
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#ifndef __BioFVM_basic_agent_h__
#define __BioFVM_basic_agent_h__
#include <vector>
#include "BioFVM_microenvironment.h"
#include "BioFVM_matlab.h"
#include "BioFVM_vector.h"
namespace BioFVM{
class Basic_Agent
{
private:
Microenvironment* microenvironment;
int selected_microenvironment;
int current_microenvironment_voxel_index;
double volume;
bool volume_is_changed;
int current_voxel_index;
int current_voxel_global_index; //-->Added by Gaurav Saxena
protected:
std::vector<double> cell_source_sink_solver_temp1;
std::vector<double> cell_source_sink_solver_temp2;
std::vector<double> previous_velocity;
bool is_active;
public:
std::vector<double> * secretion_rates;
std::vector<double> * saturation_densities;
std::vector<double> * uptake_rates;
double get_total_volume();
void set_total_volume(double);
void update_voxel_index(int mpi_Rank, int *mpi_Dims); //-->Gaurav Saxena
void set_internal_uptake_constants( double dt ); // any time you update the cell volume or rates, should call this function.
void register_microenvironment( Microenvironment* );
Microenvironment* get_microenvironment( void );
int ID;
int index;
int type;
bool assign_position(double x, double y, double z, int mpi_Rank, int *mpi_Dims); //--> Gaurav Saxena
bool assign_position(std::vector<double> new_position, int mpi_Rank, int *mpi_Dims);//--> Gaurav Saxena
std::vector<double> position;
std::vector<double> velocity;
void update_position( double dt );
Basic_Agent();
~Basic_Agent();
// simulate secretion and uptake at the nearest voxel at the indicated microenvironment.
// if no microenvironment indicated, use the currently selected microenvironment.
void simulate_secretion_and_uptake( Microenvironment* M, double dt );
int get_current_voxel_index( void );
// directly access the substrate vector at the nearest voxel at the indicated microenvironment
std::vector<double>& nearest_density_vector( int microenvironment_index ); // not implemented!
std::vector<double>& nearest_density_vector( void );
// directly access the gradient of substrate n nearest to the cell
std::vector<double>& nearest_gradient( int substrate_index );
// directly access a vector of gradients, one gradient per substrate
std::vector<gradient>& nearest_gradient_vector( void );
//void create_point_sources(double cell_radius, double dt, int num_sources, Microenvironment M, int *dims, int rank, int size, MPI_Comm comm); //---> Gaurav Saxena added this
//void create_point_sinks(double cell_radius, double dt, int num_sources, Microenvironment M, int *dims, int rank, int size, MPI_Comm comm); //---> Gaurav Saxena added this
};
extern std::vector<Basic_Agent*> all_basic_agents;
Basic_Agent* create_basic_agent( void );
void delete_basic_agent( int );
void delete_basic_agent( Basic_Agent* );
void save_all_basic_agents_to_matlab( std::string filename );
};
#endif
This diff is collapsed.
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <iostream>
#include <ctime>
#include <string>
#include <cstring>
#include <cstdio>
#include<mpi.h>
#ifndef __BioFVM_matlab_h__
#define __BioFVM_matlab_h__
namespace BioFVM{
// #include "Matrix.h"
// Paul Macklin wrote these based on documentation on the web.
// So far, matlab v4 is (partially) supported. Exceptions:
// no complex matrices
// no sparse matrices
// no text matrices
// To save in matlab and make it compatible, make sure you use:
// save -v4 <filename> <variable_name>
struct named_vector_data{
std::vector<std::string> names;
std::vector< std::vector<double> > data;
};
std::vector< std::vector<double> > read_matlab( std::string filename );
named_vector_data read_matlab_with_names( std::string filename );
bool write_matlab( std::vector< std::vector<double> >& input , std::string filename );
bool write_matlab( std::vector< std::vector<double> >& input , std::string filename , std::vector<std::string>& names );
FILE* write_matlab_header( int rows, int cols, std::string filename, std::string variable_name );
//<--------------------These two functions added by Gaurav Saxena
void write_matlab4_header( int nrows, int ncols, std::string filename, std::string variable_name, int rank, int size, MPI_Comm mpi_Cart_comm );
void write_matlab_header( int rows, int cols, std::string filename, std::string variable_name, int rank, int size, MPI_Comm mpi_Cart_comm );
// output: FILE pointer, and overwrites rows, cols so you know the size
FILE* read_matlab_header( int* rows, int* cols , std::string filename );
};
#endif
This diff is collapsed.
/*
#############################################################################
# If you use BioFVM in your project, please cite BioFVM and the version #
# number, such as below: #
# #
# We solved the diffusion equations using BioFVM (Version 1.1.6) [1] #
# #
# [1] A. Ghaffarizadeh, S.H. Friedman, and P. Macklin, BioFVM: an efficient #
# parallelized diffusive transport solver for 3-D biological simulations,#
# Bioinformatics 32(8): 1256-8, 2016. DOI: 10.1093/bioinformatics/btv730 #
# #
#############################################################################
# #
# BSD 3-Clause License (see https://opensource.org/licenses/BSD-3-Clause) #
# #
# Copyright (c) 2015-2017, Paul Macklin and the BioFVM Project #
# All rights reserved. #
# #
# Redistribution and use in source and binary forms, with or without #
# modification, are permitted provided that the following conditions are #
# met: #
# #
# 1. Redistributions of source code must retain the above copyright notice, #
# this list of conditions and the following disclaimer. #
# #
# 2. Redistributions in binary form must reproduce the above copyright #
# notice, this list of conditions and the following disclaimer in the #
# documentation and/or other materials provided with the distribution. #
# #
# 3. Neither the name of the copyright holder nor the names of its #
# contributors may be used to endorse or promote products derived from this #
# software without specific prior written permission. #
# #
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS #
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED #
# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A #
# PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER #
# OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, #
# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, #
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR #
# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF #
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING #
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #
# #
#############################################################################
*/
#ifndef __BioFVM_mesh_h__
#define __BioFVM_mesh_h__
#include <iostream>
#include <vector>
#include "BioFVM_matlab.h"
namespace BioFVM{