40#include <boost/test/tools/floating_point_comparison.hpp>
41#include <boost/test/unit_test.hpp>
49 char *args[] = {&arg};
72 zoneID, domainID, domain, 3));
78 std::make_shared<LibUtilities::Equation>(interpreter,
82 zoneID, domainID, domain, 3,
origin,
axis, angularVelEqn));
89 for (
int i = 0; i < 3; ++i)
91 velocityEqns[i] = std::make_shared<LibUtilities::Equation>(
93 displacementEqns[i] = std::make_shared<LibUtilities::Equation>(
99 zoneID, domainID, domain, 3, velocityEqns,
113 std::vector<int> compositeIDs)
116 for (
auto &
id : compositeIDs)
123 interfaceID, edge,
false));
139 std::map<int, SpatialDomains::ZoneBaseShPtr> zones = m.
GetZones();
140 BOOST_TEST(zones.size() == 2);
141 BOOST_TEST(zones.at(0).get() == zone1.get());
142 BOOST_TEST(zones.at(2).get() == zone2.get());
143 BOOST_TEST(zones.at(0) == zone1);
144 BOOST_TEST(zones.at(2) == zone2);
157 BOOST_TEST(interfaces.size() == 3);
159 std::make_pair(0,
"north")),
160 east = interfaces.at(
161 std::make_pair(1,
"east")),
162 south = interfaces.at(
163 std::make_pair(2,
"south"));
164 BOOST_TEST(north->m_leftInterface == interface1);
165 BOOST_TEST(north->m_rightInterface == interface2);
166 BOOST_TEST(east->m_leftInterface == interface2);
167 BOOST_TEST(east->m_rightInterface == interface3);
168 BOOST_TEST(south->m_leftInterface == interface3);
169 BOOST_TEST(south->m_rightInterface == interface1);
189 std::map<int, SpatialDomains::ZoneBaseShPtr> zones = m.
GetZones();
190 TiXmlElement *nektar =
new TiXmlElement(
"NEKTAR");
192 TiXmlElement *movement = nektar->FirstChildElement(
"MOVEMENT");
193 BOOST_TEST(movement);
194 TiXmlElement *xmlZones = movement->FirstChildElement(
"ZONES"),
195 *xmlInterfaces = movement->FirstChildElement(
"INTERFACES");
196 BOOST_TEST(xmlZones);
197 BOOST_TEST(xmlInterfaces);
201 std::vector<NekDouble> vec;
204 TiXmlElement *zone = xmlZones->FirstChildElement();
205 BOOST_TEST(zone->Value() ==
"F");
206 err = zone->QueryIntAttribute(
"ID", &
id);
207 BOOST_TEST(err == TIXML_SUCCESS);
209 err = zone->QueryStringAttribute(
"DOMAIN", &attr);
210 BOOST_TEST(err == TIXML_SUCCESS);
211 BOOST_TEST(attr ==
"D[10]");
214 zone = xmlZones->IterateChildren(zone)->ToElement();
215 BOOST_TEST(zone->Value() ==
"R");
216 err = zone->QueryIntAttribute(
"ID", &
id);
217 BOOST_TEST(err == TIXML_SUCCESS);
219 err = zone->QueryStringAttribute(
"DOMAIN", &attr);
220 BOOST_TEST(err == TIXML_SUCCESS);
221 BOOST_TEST(attr ==
"D[11]");
222 err = zone->QueryStringAttribute(
"ORIGIN", &attr);
223 BOOST_TEST(err == TIXML_SUCCESS);
226 err = zone->QueryStringAttribute(
"AXIS", &attr);
227 BOOST_TEST(err == TIXML_SUCCESS);
230 for (
int i = 0; i < 3; i++)
232 BOOST_TEST(xmlAxis[i] ==
axis[i]);
234 err = zone->QueryStringAttribute(
"ANGVEL", &attr);
235 BOOST_TEST(err == TIXML_SUCCESS);
239 zone = xmlZones->IterateChildren(zone)->ToElement();
240 BOOST_TEST(zone->Value() ==
"T");
241 err = zone->QueryIntAttribute(
"ID", &
id);
242 BOOST_TEST(err == TIXML_SUCCESS);
244 err = zone->QueryStringAttribute(
"DOMAIN", &attr);
245 BOOST_TEST(err == TIXML_SUCCESS);
246 BOOST_TEST(attr ==
"D[13]");
247 err = zone->QueryStringAttribute(
"XVELOCITY", &attr);
248 BOOST_TEST(err == TIXML_SUCCESS);
250 err = zone->QueryStringAttribute(
"YVELOCITY", &attr);
251 BOOST_TEST(err == TIXML_SUCCESS);
253 err = zone->QueryStringAttribute(
"ZVELOCITY", &attr);
254 BOOST_TEST(err == TIXML_SUCCESS);
256 err = zone->QueryStringAttribute(
"XDISPLACEMENT", &attr);
257 BOOST_TEST(err == TIXML_SUCCESS);
259 err = zone->QueryStringAttribute(
"YDISPLACEMENT", &attr);
260 BOOST_TEST(err == TIXML_SUCCESS);
262 err = zone->QueryStringAttribute(
"ZDISPLACEMENT", &attr);
263 BOOST_TEST(err == TIXML_SUCCESS);
266 BOOST_TEST(xmlZones->LastChild() == zone);
271 TiXmlElement *
interface = xmlInterfaces->FirstChildElement();
272 BOOST_TEST(interface->Value() ==
"INTERFACE");
273 err = interface->QueryStringAttribute(
"NAME", &attr);
274 BOOST_TEST(err == TIXML_SUCCESS);
275 BOOST_TEST(attr ==
"north");
276 intr = interface->FirstChildElement();
277 BOOST_TEST(intr->Value() ==
"L");
278 err = intr->QueryIntAttribute(
"ID", &
id);
279 BOOST_TEST(err == TIXML_SUCCESS);
281 err = intr->QueryStringAttribute(
"BOUNDARY", &attr);
282 BOOST_TEST(err == TIXML_SUCCESS);
283 BOOST_TEST(attr ==
"C[0]");
284 intr = interface->IterateChildren(intr)->ToElement();
285 BOOST_TEST(intr->Value() ==
"R");
286 err = intr->QueryIntAttribute(
"ID", &
id);
287 BOOST_TEST(err == TIXML_SUCCESS);
289 err = intr->QueryStringAttribute(
"BOUNDARY", &attr);
290 BOOST_TEST(err == TIXML_SUCCESS);
291 BOOST_TEST(attr ==
"C[1-4]");
294 interface = xmlInterfaces->IterateChildren(interface)->ToElement();
295 BOOST_TEST(interface->Value() ==
"INTERFACE");
296 err = interface->QueryStringAttribute(
"NAME", &attr);
297 BOOST_TEST(err == TIXML_SUCCESS);
298 BOOST_TEST(attr ==
"south");
299 intr = interface->FirstChildElement();
300 BOOST_TEST(intr->Value() ==
"L");
301 err = intr->QueryIntAttribute(
"ID", &
id);
302 BOOST_TEST(err == TIXML_SUCCESS);
304 err = intr->QueryStringAttribute(
"BOUNDARY", &attr);
305 BOOST_TEST(err == TIXML_SUCCESS);
306 BOOST_TEST(attr ==
"C[5-9,11]");
307 intr = interface->IterateChildren(intr)->ToElement();
308 BOOST_TEST(intr->Value() ==
"R");
309 err = intr->QueryIntAttribute(
"ID", &
id);
310 BOOST_TEST(err == TIXML_SUCCESS);
312 err = intr->QueryStringAttribute(
"BOUNDARY", &attr);
313 BOOST_TEST(err == TIXML_SUCCESS);
314 BOOST_TEST(attr ==
"C[12]");
316 BOOST_TEST(xmlInterfaces->LastChild() == interface);
static SessionReaderSharedPtr CreateInstance(int argc, char *argv[])
Creates an instance of the SessionReader class.
General purpose memory allocation routines with the ability to allocate from thread specific memory p...
static std::shared_ptr< DataType > AllocateSharedPtr(const Args &...args)
Allocate a shared pointer from the memory pool.
unsigned int GetDimension() const
Returns the number of dimensions for the point.
static bool GenerateVector(const std::string &str, std::vector< T > &out)
Takes a comma-separated string and converts it to entries in a vector.
const std::map< int, ZoneBaseShPtr > & GetZones() const
const InterfaceCollection & GetInterfaces() const
void AddInterface(std::string name, InterfaceShPtr left, InterfaceShPtr right)
Add pair of interfaces to this data.
void AddZone(ZoneBaseShPtr zone)
Add a zone object to this Movement data.
void WriteMovement(TiXmlElement *root)
Write the MOVEMENT section of the XML file.
std::shared_ptr< Interpreter > InterpreterSharedPtr
std::shared_ptr< SessionReader > SessionReaderSharedPtr
std::shared_ptr< Equation > EquationSharedPtr
LibUtilities::SessionReaderSharedPtr CreateSession()
const std::string xEqnStr
SpatialDomains::ZoneBaseShPtr CreateZone(SpatialDomains::MovementType type, int zoneID, int domainID, LibUtilities::InterpreterSharedPtr interpreter)
Produce dummy Zone objects, containing empty domain pointers.
std::vector< std::string > velocityStr
const NekPoint< NekDouble > origin
const std::string yEqnStr
SpatialDomains::InterfaceShPtr CreateInterface(int interfaceID, std::vector< int > compositeIDs)
Produce dummy Interface objects, containing empty domain pointers.
BOOST_AUTO_TEST_CASE(TestAddGetZones)
const std::string zEqnStr
const std::string angVelStr
std::vector< std::string > displacementStr
std::shared_ptr< ZoneBase > ZoneBaseShPtr
std::shared_ptr< ZoneTranslate > ZoneTranslateShPtr
std::shared_ptr< InterfacePair > InterfacePairShPtr
std::shared_ptr< ZoneRotate > ZoneRotateShPtr
std::shared_ptr< Interface > InterfaceShPtr
MovementType
Enum of zone movement type.
std::map< std::pair< int, std::string >, InterfacePairShPtr > InterfaceCollection
std::shared_ptr< ZoneFixed > ZoneFixedShPtr
std::map< int, CompositeSharedPtr > CompositeMap