-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make it possible to freely order state and position modifiers
- Loading branch information
Showing
5 changed files
with
115 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,25 @@ | ||
#include "system/SystemModifiers.hpp" | ||
using namespace cpb; | ||
|
||
void SystemModifiers::clear() { | ||
state.clear(); | ||
position.clear(); | ||
#include "system/Foundation.hpp" | ||
|
||
namespace cpb { | ||
|
||
void apply(SiteStateModifier const& m, Foundation& f) { | ||
for (auto const& pair : f.get_lattice().get_sublattices()) { | ||
auto slice = f[pair.second.unique_id]; | ||
m.apply(slice.get_states(), slice.get_positions(), pair.first); | ||
} | ||
|
||
if (m.min_neighbors > 0) { | ||
remove_dangling(f, m.min_neighbors); | ||
} | ||
} | ||
|
||
bool SystemModifiers::empty() const { | ||
return state.empty() && position.empty(); | ||
void apply(PositionModifier const& m, Foundation& f) { | ||
for (auto const& pair : f.get_lattice().get_sublattices()) { | ||
auto slice = f[pair.second.unique_id]; | ||
m.apply(slice.get_positions(), pair.first); | ||
} | ||
} | ||
|
||
} // namespace cpb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters