The normal word for "factory" in Spanish is fábrica. However, in certain contexts, the word ingenio can also be used. For example, in La fiesta del chivo, Vargas Llosa writes in reference to a sugar mill/factory in the Dominican Republic:
cuando era jefe de guardas campestres en el ingenio Boca Chica
Is there a word in Portuguese with the same/similar Latin root that means something like factory or mill? I'm particularly curious if Brazilian Portuguese uses a word similar to ingenio to refer to sugar cane mills.