Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
690ef3d
Add GitHub templates for issues and pull requests
Dec 18, 2017
0a3ed3f
Merge branch 'GitHub-templates' into develop
Dec 18, 2017
9c364b0
Update README.md
lucentdan Feb 5, 2018
4337ded
Merge branch 'pr54_update-readme' into develop
Feb 13, 2018
6b0f25a
Fixed anisotropic solidification reference grid initialization error
fields4242 Feb 13, 2018
e56e9f7
Simplify flow, improve readability, minor performance improvements
Feb 13, 2018
8e370fa
Merge branch 'issue55_error-in-anisotropic-solidification' into develop
Feb 13, 2018
e88d4e5
fixed implicit casting issue and added cygwin package reqs
Zhyrek Feb 21, 2018
5793dbd
Fixed implicit cast, solidification.cpp, and added cygwin reqs
Zhyrek Feb 22, 2018
3bdb910
Outline how to contribute.
tkphd Feb 26, 2018
c2ef2c5
Merge branch 'develop' of github:mesoscale/mmsp into issue61_document…
tkphd Feb 26, 2018
9feb9a1
address reviewer comments
tkphd Feb 26, 2018
1a4a481
Merge branch 'issue60_casting-solidification-cygwin' into develop
tkphd Feb 26, 2018
540529b
Merge branch 'develop' of github:mesoscale/mmsp into issue61_document…
tkphd Feb 26, 2018
ba911f7
Merge branch 'issue61_document-workflow' into develop
tkphd Mar 26, 2018
b63c2f4
check dimensionality before grid-size array access
tkphd Jul 17, 2018
cdace64
clear compiler warnings
tkphd Jul 18, 2018
76c6bab
resolve missing-dimension access errors with preset spatial parameter…
tkphd Jul 31, 2018
363fdbe
VTK-dependent utility compiles and runs, with errors
tkphd Aug 20, 2018
54191f5
VTK utility runs, output larger than expected, only implemented for v…
tkphd Aug 21, 2018
db00e00
functional, tested vector and sparse VTK writers
tkphd Aug 22, 2018
2dc871a
search for VTK, rather than hard-coding paths
tkphd Aug 22, 2018
2ce5fb3
enable reading built-in grids, working VTK conversion
tkphd Aug 22, 2018
dcd0dc7
replace mmsp2vti with library-based code
tkphd Aug 22, 2018
459a055
compress VTK data to float instead of double (much smaller files)
tkphd Aug 22, 2018
64b2e9b
fix VTK library detection
tkphd Oct 16, 2018
4af68b3
Merge branch 'issue63_VTI-writer' into develop
tkphd Oct 16, 2018
b78eb12
add DOI & Zenodo badge
tkphd Mar 4, 2019
947f6a9
Add tab delimiter in convert scalars
davidkleiven Apr 12, 2019
1efd9e6
more efficient PVD generator
Apr 26, 2019
c3286fb
Merge branch 'develop' of github:mesoscale/mmsp into develop
Apr 26, 2019
4521a42
increment optimization level
Apr 26, 2019
b626a95
enabled compression, yet uncertain if used
tkphd Apr 26, 2019
1434505
parallelize efficient PVD generator
tkphd Apr 29, 2019
306136d
Merge branch 'develop' of github:mesoscale/mmsp into develop
tkphd Apr 30, 2019
96aa4a0
better dependency documentation
Apr 30, 2019
9ce818c
Merge branch 'libraries' into develop
Apr 30, 2019
0b2de18
move VTK writers to separate header
May 1, 2019
7b58d8d
guard against MPI (unsupported)
May 2, 2019
0c732f6
Merge branch 'vtk' of github:mesoscale/mmsp into vtk
tkphd May 2, 2019
cd90ceb
harmonize VTK writers
tkphd May 2, 2019
0e161a7
separate PNG routines, shared include with VTK
tkphd May 2, 2019
becd1ca
Merge branch 'fix_mmsp2tsv' of github:davidkleiven/mmsp into fix_mmsp…
tkphd Jun 3, 2019
b135ba5
Merge branch 'fix_mmsp2tsv' into develop
tkphd Jun 3, 2019
a3b446e
global grid length helper
tkphd Jun 10, 2019
a8c6b04
let examples warn with verbosity
tkphd Oct 21, 2020
4fbd7a9
C-style MPI bindings in example codes
tkphd Oct 21, 2020
0303c56
back-end C-style MPI bindings
tkphd Oct 21, 2020
dbd9768
resolve OpenMPI error with non-const pointer in Allgather
tkphd Oct 22, 2020
480bb0e
Revert "resolve OpenMPI error with non-const pointer in Allgather"
tkphd Oct 22, 2020
5e258cb
evade dodgy OpenMPI compiler error
tkphd Oct 22, 2020
27ea5f7
Merge branch 'issue71-c++bindings-deprecated' into develop
tkphd Nov 5, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
### There's a *broken feature* in MMSP
- Bug appears in {file or program}
- Encountered running on {CPU} and {accelerator} using {OS} with {relevant software}
- The expected behavior is
- The observed behavior is

### There's a *missing feature* in MMSP
- The gap is in {file or program}
- It deserves attention because
- A possible approach is

### There's a *confusing feature* in MMSP
- Join the conversation on [gitter](https://gitter.im/mesoscale/mmsp)!
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
The proposed changes are intended to {summary of intent}.

This is achieved by {description of method}.

Fixes #, Addresses #

The modified code may have unintended consequences in {areas of concern}.
130 changes: 130 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Contributing to [MMSP: The Mesoscale Microstructure Simulation Project][_mmsp]

Thank you for spending some time with MMSP. We sincerely appreciate your
interest, and hope you will consider contributing to the documentation,
source code, and community at large. This code is open-source, and we really
appreciate input from the community. There are several ways you can contribute,
including editing or adding documentation, writing tutorials, submitting bug
reports, requesting new features, and writing code to incorporate. If you'd like
to help out, please do!

If you're looking for support or guidance, please visit our [Gitter chat][_gitter]
to talk with the developers and community members, or send an e-mail to
<trevor.keller@gmail.com>.

## Ground Rules

- Help us to maintain a considerate and supportive community by reading and
enforcing the [Code of Conduct][_conduct]. Be nice to newcomers.
- Promote clean code by ensuring your code and documentation build with neither
warnings nor errors using compiler flags equivalent to [GCC's][_gcc]
`-Wall -pedantic`.
- Engage with the community by creating [issues][_issue] for changes or
enhancements you'd like to make. Discuss ideas the open and get feedback.
- Maximize reusability by keeping code simple. Program in C if possible, and
generally follow the [Google C++ Style Guide][_goog]. Avoid creating new
classes if possible.
- Document new functions and classes with [Doxygen][_doxy]-compatible comments
in the source code.

## Getting Started

Interested in helping, but unsure where to start? Consider proofreading the PDF
documentation and reporting or fixing errors! There's bound to be a typo in
there. Or look through the existing [issues][_issue] for fixes or enhancements
you're interested in. The number of comments on an issue can indicate its level
of difficulty, as well as the impact closing it will have.

If you're brand new to open source, welcome! You might benefit from the
[GitHub Help Pages][_ghhelp] and a [tutorial][_tut].

## Branching Workflow

[MMSP][_mmsp] uses [git][_git] version control with a [branching workflow][_branch],
summarized below. Following this workflow ensures a pristine `master` branch
that remains synchronized, and allows collaborators to quickly and easily review
contributions for content and quality.

The core mantra is ***never commit to `master`***. On [mesoscale/mmsp][_mmsp],
`master` is the rolling release branch, and code must only be merged into it
following [continuous integration][_ci] testing, code review, and discussion.

Changes are made on *branches*, using `master` as the trunk. Ideally, a branch
is created based on an [issue][_issue], which captures a *feature* or *hotfix*
to MMSP. To paraphrase illustrations of more involved workflows, a simple
branching model for MMSP looks like the following, with `B` indicating a branch
named `___`, `M` a commit with message `"___"`, `?` a pull request, and `D`
deletion of a branch. Note that branches are numbered sequentially, using the
number of the [issue][_issue] outlining the missing or broken functionality to
be patched.

```
mesoscale/ origin/ origin/
master hotfix feature hotfix feature
:
|
+-----------------------------------------B issue4
| |
+--------------------------B bug5 M "create function"
| M "missing ;" M "update docs"
| ?----------------+ |
"merge bug5" M---------+ | |
| D D |
+-----------------------------------------M "merge master"
| ?-----------------------+
| | M "address comments"
| M-----------------------+
"merge issue4" M-----------------+ |
| D D
:
```

## Pull Requests

*Please neither commit directly to the `master` branch, nor push directly to
mesoscale/mmsp.*

1. Create a fork of [MMSP][_mmsp] on your personal GitHub account.
2. For obvious changes, such as typos or edits to `.gitignore`, you can edit
your fork directly in the browser, then file a [pull request][_pr].
3. Most changes begin with an [Issue][_issue]. If one does not exist, create it.
4. On your local machine, use the command line to work on your local fork of
[MMSP][_mmsp]. Create a working branch off of `master`. If you're working,
for example, on issue #42, *function template documentation*:
- [Fork][_ghhelp] mesoscale/mmsp and [clone][_ghhelp] it to your local machine.
Your fork is a `git remote` with the alias `origin` by default.
- `git pull https://github.com/mesoscale/mmsp.git master` to update your
local `master` branch from the main repository.
- `git checkout -b issue42_function-template-documentation master` to
create a local feature branch off of `master`.
- Write your edits, updates, or feature code.
- `git status`, `git add -u`, `git status`, and `git commit`,
in that order, to add your changes. If something is amiss, follow
the terminal guidance to fix it.
- Write a concise commit message (first line), then in-depth commentary below
using the keywords ["Addresses" or "Closes"][_ghkey] where appropriate.
- `git push origin issue42_summarize-usage-in-pseudocode` to push the
*working branch* to your fork on GitHub.
5. Visit GitHub and make the pull request official. Please fill out the pull
request template and assign a reviewer &emdash; `@tkphd` if noone else suits.

Obvious fixes will be merged quickly. Enhancements may undergo a code review,
which we typically conduct using [reviewable][_review].

## Happy Coding!

[_mmsp]: https://github.com/mesoscale/mmsp
[_branch]: http://nvie.com/posts/a-successful-git-branching-model/
[_ci]: https://docs.travis-ci.com/
[_conduct]: https://github.com/mesoscale/mmsp/blob/master/CODE_OF_CONDUCT.md
[_doxy]: https://www.stack.nl/~dimitri/doxygen/manual/docblocks.html
[_gcc]: https://gcc.gnu.org/
[_ghhelp]: https://help.github.com/
[_ghkey]: https://help.github.com/articles/closing-issues-using-keywords/
[_git]: https://git-scm.com/
[_gitter]: https://gitter.im/mesoscale/mmsp
[_goog]: https://google.github.io/styleguide/cppguide.html
[_issue]: https://github.com/mesoscale/mmsp/issues
[_pr]: https://help.github.com/articles/about-pull-requests/
[_review]: https://reviewable.io/reviews/mesoscale/mmsp
[_tut]: https://egghead.io/courses/how-to-contribute-to-an-open-source-project-on-github
14 changes: 9 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
Mesoscale Microstructure Simulation Project
====
[![Build Status](https://travis-ci.org/mesoscale/mmsp.svg?branch=develop)](https://travis-ci.org/mesoscale/mmsp)
[![DOI](https://zenodo.org/badge/19985417.svg)](https://zenodo.org/badge/latestdoi/19985417)

The goal of the Mesoscale Microstructure Simulation Project (MMSP) is to provide a simple,
consistent, and extensible programming interface for all grid and mesh based microstructure
Expand Down Expand Up @@ -42,18 +43,21 @@ MMSP is nothing more than a collection of C++ header files that declare a number
*MMSP requires:*

* Minimal programming experience
* An ISO compliant C++ compiler (e.g. GCC 2.95 or later)
* zlib libraries for data compression (e.g. zlib 1.2.7)
* libpng headers for mmsp2png image generation utility (e.g. libpng12-dev)
* MPI libraries if compiling parallel programs (e.g. Open MPI)
* An ISO compliant C++ compiler (e.g. `gcc` 2.95 or later)
* zlib libraries for data compression (e.g. `zlib` 1.2.7)
* libpng headers for mmsp2png image generation utility (e.g. `libpng12-dev`)
* ParaView VTK headers for VTI and PVD visualization utilities (e.g. `paraview` and `paraview-dev`)
* MPI libraries if compiling parallel programs (e.g. `openmpi`)

*Documentation*

The MMSP manual is a work in progress. It is currently the only source for detailed documentation about MMSP.

*Contact us*

The administrators for the MMSP source code are Jason Gruber (gruberja@gmail.com) and Trevor Keller (trevor.keller@gmail.com). Please do not hesitate to send questions or comments.
The administrators for the MMSP source code are Jason Gruber (gruberja@gmail.com), Trevor Keller (trevor.keller@gmail.com) and Dan Lewis (lucentdan@gmail.com). Please do not hesitate to send questions or comments. Please cite using the following DOI:

[![DOI](https://zenodo.org/badge/19985417.svg)](https://zenodo.org/badge/latestdoi/19985417)


This work was supported in part by the US NSF under award #1056704 through the Metals and Metallic Nanostructures Program, Division of Materials Research.
55 changes: 27 additions & 28 deletions algorithms/generators.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// generators.cpp
// Implementations of methods to initialize MMSP grids
#ifndef _GENERATORS_CPP_
#define _GENERATORS_CPP_
Expand Down Expand Up @@ -81,9 +80,9 @@ MMSP::vector<int> getPosition(const DistanceVoxel& dv) {

template<int dim, typename T>
void exact_voronoi(MMSP::grid<dim, MMSP::sparse<T> >& grid, const std::vector<std::vector<MMSP::vector<int> > >& seeds) {
int id=0;
int id = 0;
#ifdef MPI_VERSION
id=MPI::COMM_WORLD.Get_rank();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
#endif
// Exact Voronoi tessellation from seeds, based on Euclidean distance function. Runtime is O(Nseeds*L*W*H).
// seeds must contain every seed from every rank.
Expand Down Expand Up @@ -193,7 +192,7 @@ void approximate_voronoi(MMSP::grid<dim, MMSP::sparse<T> >& grid, const std::vec
#endif
int id = 0;
#ifdef MPI_VERSION
id = MPI::COMM_WORLD.Get_rank();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
#endif
// Perform the tessellation, using fast-marching fanciness
if (dim == 2) {
Expand Down Expand Up @@ -400,7 +399,9 @@ void approximate_voronoi(MMSP::grid<dim, MMSP::sparse<T> >& grid, const std::vec
}
#ifdef DEBUG
#ifdef MPI_VERSION
if (MPI::COMM_WORLD.Get_rank()==0)
int id = 0;
MPI_Comm_rank(MPI_COMM_WORLD, &id);
if (id==0)
#endif
std::cout<<"Completed approximate tessellation ("<<time(NULL)-tstart<<" sec)."<<std::endl;
#endif
Expand All @@ -409,23 +410,24 @@ void approximate_voronoi(MMSP::grid<dim, MMSP::sparse<T> >& grid, const std::vec
void seedswap(std::vector<std::vector<MMSP::vector<int> > >& seeds)
{
#ifdef MPI_VERSION
int id=MPI::COMM_WORLD.Get_rank();
int np=MPI::COMM_WORLD.Get_size();
int id=0, np=0;
MPI_Comm_rank(MPI_COMM_WORLD, &id);
MPI_Comm_size(MPI_COMM_WORLD, &np);
// Exchange seeds between all processors
int send_size=3*seeds[id].size(); // number of integers
int* send_buffer = new int[send_size]; // number of integers
send_size = seeds_to_buffer(seeds[id], send_buffer);
int* seed_sizes = new int[np];
MPI::COMM_WORLD.Barrier();
MPI::COMM_WORLD.Allgather(&send_size, 1, MPI_INT, seed_sizes, 1, MPI_INT);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Allgather(&send_size, 1, MPI_INT, seed_sizes, 1, MPI_INT, MPI_COMM_WORLD);
int total_size=0;
for (int i=0; i<np; ++i) total_size+=seed_sizes[i];
int* offsets = new int[np];
offsets[0]=0;
for (int i=1; i<np; ++i) offsets[i]=seed_sizes[i-1]+offsets[i-1];
int* seed_block = new int[total_size];
MPI::COMM_WORLD.Barrier();
MPI::COMM_WORLD.Allgatherv(send_buffer, send_size, MPI_INT, seed_block, seed_sizes, offsets, MPI_INT);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Allgatherv(send_buffer, send_size, MPI_INT, seed_block, seed_sizes, offsets, MPI_INT, MPI_COMM_WORLD);
delete [] send_buffer; send_buffer=NULL;

for (int i=0; i<np; ++i) {
Expand All @@ -437,8 +439,8 @@ void seedswap(std::vector<std::vector<MMSP::vector<int> > >& seeds)
delete [] seed_block; seed_block=NULL;
int vote=1;
int total_procs=0;
MPI::COMM_WORLD.Barrier();
MPI::COMM_WORLD.Allreduce(&vote, &total_procs, 1, MPI_INT, MPI_SUM);
MPI_Barrier(MPI_COMM_WORLD);
MPI_Allreduce(&vote, &total_procs, 1, MPI_INT, MPI_SUM, MPI_COMM_WORLD);
#ifdef DEBUG
if (id==0) std::cout<<"Synchronized "<<np*seeds[id].size()<<" seeds on "<<total_procs<<" ranks."<<std::endl;
#endif
Expand All @@ -448,11 +450,10 @@ void seedswap(std::vector<std::vector<MMSP::vector<int> > >& seeds)
template<int dim>
void seeds_from_poisson_process(const int x0[dim], const int x1[dim], const int g0[dim], const int g1[dim], const int& nseeds, std::vector<std::vector<MMSP::vector<int> > >& seeds)
{
int id=0;
int np=1;
int id=0, np=1;
#ifdef MPI_VERSION
id=MPI::COMM_WORLD.Get_rank();
np=MPI::COMM_WORLD.Get_size();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
MPI_Comm_size(MPI_COMM_WORLD, &np);
#endif
std::vector<MMSP::vector<int> > local_seeds; // blank for now
seeds.clear();
Expand Down Expand Up @@ -482,7 +483,7 @@ void seeds_to_file(const int g0[dim], const int g1[dim], const std::vector<std::
{
int id=0;
#ifdef MPI_VERSION
id=MPI::COMM_WORLD.Get_rank();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
#endif
if (id==0) {
std::ofstream output(filename);
Expand All @@ -496,18 +497,17 @@ void seeds_to_file(const int g0[dim], const int g1[dim], const std::vector<std::
output.close();
}
#ifdef MPI_VERSION
MPI::COMM_WORLD.Barrier();
MPI_Barrier(MPI_COMM_WORLD);
#endif
}

template<int dim>
void seeds_from_file(const int x0[dim], const int x1[dim], const int g0[dim], const int g1[dim], const char* seedfilename, std::vector<std::vector<MMSP::vector<int> > >& seeds)
{
int id=0;
int np=1;
int id=0, np=1;
#ifdef MPI_VERSION
id=MPI::COMM_WORLD.Get_rank();
np=MPI::COMM_WORLD.Get_size();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
MPI_Comm_size(MPI_COMM_WORLD, &np);
#endif
std::ifstream input(seedfilename);
if (!input) {
Expand Down Expand Up @@ -547,11 +547,10 @@ void seeds_from_file(const int x0[dim], const int x1[dim], const int g0[dim], co
template<int dim>
void honeycomb_seeds(const int x0[dim], const int x1[dim], const int g0[dim], const int g1[dim], const int a, std::vector<std::vector<MMSP::vector<int> > >& seeds)
{
int id=0;
int np=1;
int id=0, np=1;
#ifdef MPI_VERSION
id=MPI::COMM_WORLD.Get_rank();
np=MPI::COMM_WORLD.Get_size();
MPI_Comm_rank(MPI_COMM_WORLD, &id);
MPI_Comm_size(MPI_COMM_WORLD, &np);
#endif
std::vector<MMSP::vector<int> > local_seeds; // blank for now
seeds.clear();
Expand Down Expand Up @@ -597,7 +596,7 @@ void tessellate(MMSP::grid<dim, MMSP::sparse<T> >& grid, const int& nseeds) {
approximate_voronoi<dim,T>(grid, seeds);
#else
exact_voronoi<dim,T>(grid, seeds);
MPI::COMM_WORLD.Barrier();
MPI_Barrier(MPI_COMM_WORLD);
#endif
} // tessellate

Expand Down
Loading